July 03, 2025, 06:07:57 PM

Recent posts

#1
ESP32 / Re: ESP32-SBC-FabGL .. PCemula...
Last post by therese80 - Today at 05:02:24 PM
hi,
thanks for all this suggestion , but none work...
Used Arduino/PlatformIO


the only don't have tested ,it is the hardware modif. of U1 .. i have no tool for this moment .. and U1 is SMD ..

i gonna to find someone to make modification .

i have rp2040-pico-pc , implemented PicoMite 6.00.02 and work at first boot , and the same  SDCARD used for copy prog. between my laptop .

@+
TRS80
#2
ESP32 / Re: ESP32-SBC-FabGL .. PCemula...
Last post by LubOlimex - July 02, 2025, 02:51:33 PM
One SPI goes to SD card and to the CH32V003 and depending on the CS state one or the other will be used. Important here is that there is also SN74LVC1G04DBVR(SOT23-5) invertor on the CS line specifically.
#3
ESP32 / Re: ESP32-SBC-FabGL .. PCemula...
Last post by LubOlimex - July 02, 2025, 02:50:18 PM
It can work without holding the CH chip in reset if you invert the CS logic. E.g. change CS from pin 13 to pin -13. Try the following demo:

/*
 * pin 1 - not used          |  Micro SD card     |
 * pin 2 - CS (SS)           |                   /
 * pin 3 - DI (MOSI)         |                  |__
 * pin 4 - VDD (3.3V)        |                    |
 * pin 5 - SCK (SCLK)        | 8 7 6 5 4 3 2 1   /
 * pin 6 - VSS (GND)         | ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄  /
 * pin 7 - DO (MISO)         | ▀ ▀ █ ▀ █ ▀ ▀ ▀ |
 * pin 8 - not used          |_________________|
 *                             ║ ║ ║ ║ ║ ║ ║ ║
 *                     ╔═══════╝ ║ ║ ║ ║ ║ ║ ╚═════════╗
 *                     ║         ║ ║ ║ ║ ║ ╚══════╗    ║
 *                     ║   ╔═════╝ ║ ║ ║ ╚═════╗  ║    ║
 * Connections for     ║   ║   ╔═══╩═║═║═══╗   ║  ║    ║
 * full-sized          ║   ║   ║   ╔═╝ ║   ║   ║  ║    ║
 * SD card             ║   ║   ║   ║   ║   ║   ║  ║    ║
 * Pin name         |  -  DO  VSS SCK VDD VSS DI CS    -  |
 * SD pin number    |  8   7   6   5   4   3   2   1   9 /
 *                  |                                  █/
 *                  |__▍___▊___█___█___█___█___█___█___/
 *
 * Note:  The SPI pins can be manually configured by using `SPI.begin(sck, miso, mosi, cs).`
 *        Alternatively, you can change the CS pin and use the other default settings by using `SD.begin(cs)`.
 *
 * +--------------+---------+-------+----------+----------+----------+----------+----------+
 * | SPI Pin Name | ESP8266 | ESP32 | ESP32‑S2 | ESP32‑S3 | ESP32‑C3 | ESP32‑C6 | ESP32‑H2 |
 * +==============+=========+=======+==========+==========+==========+==========+==========+
 * | CS (SS)      | GPIO15  | GPIO5 | GPIO34   | GPIO10   | GPIO7    | GPIO18   | GPIO0    |
 * +--------------+---------+-------+----------+----------+----------+----------+----------+
 * | DI (MOSI)    | GPIO13  | GPIO23| GPIO35   | GPIO11   | GPIO6    | GPIO19   | GPIO25   |
 * +--------------+---------+-------+----------+----------+----------+----------+----------+
 * | DO (MISO)    | GPIO12  | GPIO19| GPIO37   | GPIO13   | GPIO5    | GPIO20   | GPIO11   |
 * +--------------+---------+-------+----------+----------+----------+----------+----------+
 * | SCK (SCLK)   | GPIO14  | GPIO18| GPIO36   | GPIO12   | GPIO4    | GPIO21   | GPIO10   |
 * +--------------+---------+-------+----------+----------+----------+----------+----------+
 *
 * For more info see file README.md in this library or on URL:
 * https://github.com/espressif/arduino-esp32/tree/master/libraries/SD
 */

#include "FS.h"
#include "SD.h"
#include "SPI.h"

#define REASSIGN_PINS
int sck = 14;
int miso = 35;
int mosi = 12;
int cs = -13;

void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
  Serial.printf("Listing directory: %s\n", dirname);

  File root = fs.open(dirname);
  if (!root) {
    Serial.println("Failed to open directory");
    return;
  }
  if (!root.isDirectory()) {
    Serial.println("Not a directory");
    return;
  }

  File file = root.openNextFile();
  while (file) {
    if (file.isDirectory()) {
      Serial.print("  DIR : ");
      Serial.println(file.name());
      if (levels) {
        listDir(fs, file.path(), levels - 1);
      }
    } else {
      Serial.print("  FILE: ");
      Serial.print(file.name());
      Serial.print("  SIZE: ");
      Serial.println(file.size());
    }
    file = root.openNextFile();
  }
}

void createDir(fs::FS &fs, const char *path) {
  Serial.printf("Creating Dir: %s\n", path);
  if (fs.mkdir(path)) {
    Serial.println("Dir created");
  } else {
    Serial.println("mkdir failed");
  }
}

void removeDir(fs::FS &fs, const char *path) {
  Serial.printf("Removing Dir: %s\n", path);
  if (fs.rmdir(path)) {
    Serial.println("Dir removed");
  } else {
    Serial.println("rmdir failed");
  }
}

void readFile(fs::FS &fs, const char *path) {
  Serial.printf("Reading file: %s\n", path);

  File file = fs.open(path);
  if (!file) {
    Serial.println("Failed to open file for reading");
    return;
  }

  Serial.print("Read from file: ");
  while (file.available()) {
    Serial.write(file.read());
  }
  file.close();
}

void writeFile(fs::FS &fs, const char *path, const char *message) {
  Serial.printf("Writing file: %s\n", path);

  File file = fs.open(path, FILE_WRITE);
  if (!file) {
    Serial.println("Failed to open file for writing");
    return;
  }
  if (file.print(message)) {
    Serial.println("File written");
  } else {
    Serial.println("Write failed");
  }
  file.close();
}

void appendFile(fs::FS &fs, const char *path, const char *message) {
  Serial.printf("Appending to file: %s\n", path);

  File file = fs.open(path, FILE_APPEND);
  if (!file) {
    Serial.println("Failed to open file for appending");
    return;
  }
  if (file.print(message)) {
    Serial.println("Message appended");
  } else {
    Serial.println("Append failed");
  }
  file.close();
}

void renameFile(fs::FS &fs, const char *path1, const char *path2) {
  Serial.printf("Renaming file %s to %s\n", path1, path2);
  if (fs.rename(path1, path2)) {
    Serial.println("File renamed");
  } else {
    Serial.println("Rename failed");
  }
}

void deleteFile(fs::FS &fs, const char *path) {
  Serial.printf("Deleting file: %s\n", path);
  if (fs.remove(path)) {
    Serial.println("File deleted");
  } else {
    Serial.println("Delete failed");
  }
}

void testFileIO(fs::FS &fs, const char *path) {
  File file = fs.open(path);
  static uint8_t buf[512];
  size_t len = 0;
  uint32_t start = millis();
  uint32_t end = start;
  if (file) {
    len = file.size();
    size_t flen = len;
    start = millis();
    while (len) {
      size_t toRead = len;
      if (toRead > 512) {
        toRead = 512;
      }
      file.read(buf, toRead);
      len -= toRead;
    }
    end = millis() - start;
    Serial.printf("%u bytes read for %lu ms\n", flen, end);
    file.close();
  } else {
    Serial.println("Failed to open file for reading");
  }

  file = fs.open(path, FILE_WRITE);
  if (!file) {
    Serial.println("Failed to open file for writing");
    return;
  }

  size_t i;
  start = millis();
  for (i = 0; i < 2048; i++) {
    file.write(buf, 512);
  }
  end = millis() - start;
  Serial.printf("%u bytes written for %lu ms\n", 2048 * 512, end);
  file.close();
}

void setup() {
  Serial.begin(115200);

#ifdef REASSIGN_PINS
  SPI.begin(sck, miso, mosi, cs);
  if (!SD.begin(cs)) {
#else
  if (!SD.begin()) {
#endif
    Serial.println("Card Mount Failed");
    return;
  }
  uint8_t cardType = SD.cardType();

  if (cardType == CARD_NONE) {
    Serial.println("No SD card attached");
    return;
  }

  Serial.print("SD Card Type: ");
  if (cardType == CARD_MMC) {
    Serial.println("MMC");
  } else if (cardType == CARD_SD) {
    Serial.println("SDSC");
  } else if (cardType == CARD_SDHC) {
    Serial.println("SDHC");
  } else {
    Serial.println("UNKNOWN");
  }

  uint64_t cardSize = SD.cardSize() / (1024 * 1024);
  Serial.printf("SD Card Size: %lluMB\n", cardSize);

  listDir(SD, "/", 0);
  createDir(SD, "/mydir");
  listDir(SD, "/", 0);
  removeDir(SD, "/mydir");
  listDir(SD, "/", 2);
  writeFile(SD, "/hello.txt", "Hello ");
  appendFile(SD, "/hello.txt", "World!\n");
  readFile(SD, "/hello.txt");
  deleteFile(SD, "/foo.txt");
  renameFile(SD, "/hello.txt", "/foo.txt");
  readFile(SD, "/foo.txt");
  testFileIO(SD, "/test.txt");
  Serial.printf("Total space: %lluMB\n", SD.totalBytes() / (1024 * 1024));
  Serial.printf("Used space: %lluMB\n", SD.usedBytes() / (1024 * 1024));
}

void loop() {}
#4
ESP32 / Re: ESP32-SBC-FabGL .. PCemula...
Last post by LubOlimex - July 02, 2025, 02:10:00 PM
Ok, so I tested and I can confirm this is not a problem with your board. I have same behavior here and it is because the SD card won't work with demos found over the internet.

This is because of the CH32V003F4P6(TSSOP20) expander chip. If you track the wires of the SD card - MISO, MOSI, CS, clock - all of them go not only to the ESP32-WROVER module but also to the U1 extender and it influences them.

If I hold the extender chip in reset (U1's pin 4 to ground) the SD card examples from the internet will work without issues.

So to interact with the SD card you need to first to interact with the CH32V003 firmware and driver:

https://github.com/OLIMEX/ESP32-SBC-FabGL/tree/main/SOFTWARE/CH32V003_Driver

You need to use our fork or CH32V003 will not be accounted for!

By the way, maybe check this customer project for first steps with the board:

https://github.com/MrSoxAndShoes/esp32-sbc-fabgl-quick-start

#5
New Product Ideas / Re: GateMateA1 for TERES-I
Last post by olimex - July 02, 2025, 12:59:17 PM
What CPU architecture do you want to make?
At what speed it will run?
Are you capable to make proper Linux support too?
#6
ESP32 / Re: ESP32-SBC-FabGL .. PCemula...
Last post by therese80 - July 02, 2025, 12:40:50 PM
Quote from: LubOlimex on July 02, 2025, 08:21:02 AMEach board is tested after manufacturing, there is also empirical test of the SD card. Board defect is not very likely.

Later today I will test with simple SD card project like you under Arduino IDE one of the boards here and will give you sample code to test.

thanks for your advice .

i tested with example :
Altair8800 , in code when fail to mount SDCARD , it mount drive on Flash ... no error message... but sdCARD still unmount

PCEmulator when fail mountSDCARD .. doesn't mount drive in flash and popup display error

Very strange i have tested this 2 examples and my testsdcard with Arduino and Platformio !

@+
TRS80

#7
ESP32 / Re: ESP32-SBC-FabGL .. PCemula...
Last post by LubOlimex - July 02, 2025, 08:21:02 AM
Each board is tested after manufacturing, there is also empirical test of the SD card. Board defect is not very likely.

Later today I will test with simple SD card project like you under Arduino IDE one of the boards here and will give you sample code to test.
#8
ESP32 / Re: ESP32-SBC-FabGL .. PCemula...
Last post by therese80 - July 02, 2025, 12:43:40 AM
hi ,
make several test ...

format my sdcard in fat32
write text file using my laptop

rp2040-pico-pc : ok read/write
esp32-sbc-fabgl : mount failed ..

i make a simple arduino programme(platformio) to mount/write/read SDCARD
esp32-sbc-fabgl : [  6053][E][sd_diskio.cpp:806] sdcard_mount(): f_mount failed: (3) The physical drive cannot work

annex : programme test SDCARD
Board defect ?

@+
TRS80

#define LED_YELLOW 2
#define HSPI_SCK 14
#define HSPI_MISO 35
#define HSPI_MOSI 12
#define SD_CS 13

#include "FS.h"
#include "SD.h"
#include "SPI.h"

SPIClass * hspi = NULL;



void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
    Serial.printf("Listing directory: %s\n", dirname);

    File root = fs.open(dirname);
    if(!root){
        Serial.println("Failed to open directory");
        return;
    }
    if(!root.isDirectory()){
        Serial.println("Not a directory");
        return;
    }

    File file = root.openNextFile();
    while(file){
        if(file.isDirectory()){
            Serial.print("  DIR : ");
            Serial.println(file.name());
            if(levels){
                listDir(fs, file.name(), levels -1);
            }
        } else {
            Serial.print("  FILE: ");
            Serial.print(file.name());
            Serial.print("  SIZE: ");
            Serial.println(file.size());
        }
        file = root.openNextFile();
    }
}

void createDir(fs::FS &fs, const char * path){
    Serial.printf("Creating Dir: %s\n", path);
    if(fs.mkdir(path)){
        Serial.println("Dir created");
    } else {
        Serial.println("mkdir failed");
    }
}

void removeDir(fs::FS &fs, const char * path){
    Serial.printf("Removing Dir: %s\n", path);
    if(fs.rmdir(path)){
        Serial.println("Dir removed");
    } else {
        Serial.println("rmdir failed");
    }
}

void readFile(fs::FS &fs, const char * path){
    Serial.printf("Reading file: %s\n", path);

    File file = fs.open(path);
    if(!file){
        Serial.println("Failed to open file for reading");
        return;
    }

    Serial.print("Read from file: ");
    while(file.available()){
        Serial.write(file.read());
    }
    file.close();
}

void writeFile(fs::FS &fs, const char * path, const char * message){
    Serial.printf("Writing file: %s\n", path);

    File file = fs.open(path, FILE_WRITE);
    if(!file){
        Serial.println("Failed to open file for writing");
        return;
    }
    if(file.print(message)){
        Serial.println("File written");
    } else {
        Serial.println("Write failed");
    }
    file.close();
}

void appendFile(fs::FS &fs, const char * path, const char * message){
    Serial.printf("Appending to file: %s\n", path);

    File file = fs.open(path, FILE_APPEND);
    if(!file){
        Serial.println("Failed to open file for appending");
        return;
    }
    if(file.print(message)){
        Serial.println("Message appended");
    } else {
        Serial.println("Append failed");
    }
    file.close();
}

void renameFile(fs::FS &fs, const char * path1, const char * path2){
    Serial.printf("Renaming file %s to %s\n", path1, path2);
    if (fs.rename(path1, path2)) {
        Serial.println("File renamed");
    } else {
        Serial.println("Rename failed");
    }
}

void deleteFile(fs::FS &fs, const char * path){
    Serial.printf("Deleting file: %s\n", path);
    if(fs.remove(path)){
        Serial.println("File deleted");
    } else {
        Serial.println("Delete failed");
    }
}

void testFileIO(fs::FS &fs, const char * path){
    File file = fs.open(path);
    static uint8_t buf[512];
    size_t len = 0;
    uint32_t start = millis();
    uint32_t end = start;
    if(file){
        len = file.size();
        size_t flen = len;
        start = millis();
        while(len){
            size_t toRead = len;
            if(toRead > 512){
                toRead = 512;
            }
            file.read(buf, toRead);
            len -= toRead;
        }
        end = millis() - start;
        Serial.printf("%u bytes read for %u ms\n", flen, end);
        file.close();
    } else {
        Serial.println("Failed to open file for reading");
    }


    file = fs.open(path, FILE_WRITE);
    if(!file){
        Serial.println("Failed to open file for writing");
        return;
    }

    size_t i;
    start = millis();
    for(i=0; i<2048; i++){
        file.write(buf, 512);
    }
    end = millis() - start;
    Serial.printf("%u bytes written for %u ms\n", 2048 * 512, end);
    file.close();
}

void setup(){
    Serial.begin(115200);
    pinMode(LED_YELLOW,OUTPUT);
    digitalWrite(LED_YELLOW, LOW);  // active LOW
    delay(5000);
    hspi = new SPIClass(HSPI);

    hspi->begin(HSPI_SCK, HSPI_MISO, HSPI_MOSI, SD_CS);
    //hspi->begin();
   
   
    if(!SD.begin(SD_CS, *hspi)){
        Serial.println("Card Mount Failed");
        return;
    }
    uint8_t cardType = SD.cardType();

    if(cardType == CARD_NONE){
        Serial.println("No SD card attached");
        return;
    }

    Serial.print("SD Card Type: ");
    if(cardType == CARD_MMC){
        Serial.println("MMC");
    } else if(cardType == CARD_SD){
        Serial.println("SDSC");
    } else if(cardType == CARD_SDHC){
        Serial.println("SDHC");
    } else {
        Serial.println("UNKNOWN");
    }

    uint64_t cardSize = SD.cardSize() / (1024 * 1024);
    Serial.printf("SD Card Size: %lluMB\n", cardSize);

    listDir(SD, "/", 0);
    createDir(SD, "/mydir");
    listDir(SD, "/", 0);
    removeDir(SD, "/mydir");
    listDir(SD, "/", 2);
    writeFile(SD, "/hello.txt", "Hello ");
    appendFile(SD, "/hello.txt", "World!\n");
    readFile(SD, "/hello.txt");
    deleteFile(SD, "/foo.txt");
    renameFile(SD, "/hello.txt", "/foo.txt");
    readFile(SD, "/foo.txt");
    testFileIO(SD, "/test.txt");
    Serial.printf("Total space: %lluMB\n", SD.totalBytes() / (1024 * 1024));
    Serial.printf("Used space: %lluMB\n", SD.usedBytes() / (1024 * 1024));
    digitalWrite(LED_YELLOW, HIGH);  // active LOW   

}

void loop(){

}
#9
New Product Ideas / GateMateA1 for TERES-I
Last post by os3o3 - July 01, 2025, 10:55:08 PM
Hi,

I understand that Olimex wants that the TERES-I be able to run a full Linux distribution.

I have an other point of view. I want a fully Open Source computer running a fully custom CPU with a minimal OS.

I want to use an FPGA to make a prototype and proof of concept.

In a far distant future I would like to turn the FPGA design to an ASIC using low end silicon technology (~130nm).

So my goal is to have a "retro computer" like laptop with custom processing unit. Like the Neo6502pc, but in a real laptop format.

The GateMateA1-EVB is nice, I can use it. But I would like to integrate it into a portable computer. To do so I must design some add-on boards or make a new TERES main board.

Is there some potential customers for a GateMateA1-EVB merged into a TERES-PCB1-A64 form factor ?

And of course as always, I have a lot of idea and little money ;-)


https://www.olimex.com/forum/index.php?topic=6074.0

https://www.olimex.com/forum/index.php?topic=8817.0


 :P
#10
ESP32 / Re: ESP32-SBC-FabGL .. PCemula...
Last post by therese80 - July 01, 2025, 04:00:14 PM
Hi LubOlimex ,
thanks a lot for the answer .
In the code of PCEmulator( fork of Olimex)

Error is generated at line 391 :: try to mount sdcard with "FileBrowser::mountSDCard"

the default value are :



Parameters:
formatOnFail – Formats SD Card when it cannot be mounted.
mountPath – Mount directory (ex. "/sdcard").
maxFiles – Number of files that can be open at the time (default 4).
allocationUnitSize – Allocation unit size (default 16K).
MISO – Pin for MISO signal (default 16 for WROOM-32, 2 for PICO-D4).
MOSI – Pin for MOSI signal (default 17 for WROOM-32, 12 for PICO-D4).
CLK – Pin for CLK signal (default 14).
CS – Pin for CS signal (default 13).

i replaced with value that's you have suggested ::

if (!FileBrowser::mountSDCard(false, SD_MOUNT_PATH, 8,35,12,14,13))   // @TODO: reduce to 4?

Always same error ...

I investigate on the content of the sdcard and image downloaded ..

@

trs80 aka therese80