Navigation

    LILYGO

    • Register
    • Login
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. rs77can
    R
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 8
    • Best 2
    • Groups 0

    rs77can

    @rs77can

    2
    Reputation
    1
    Profile views
    8
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    rs77can Unfollow Follow

    Best posts made by rs77can

    • RE: AMOLED S3 T-Display Touch - Problem with reading SD Card

      @rs77can That did not work either - cant mount card

      I tried this

      https://github.com/espressif/arduino-esp32/blob/master/libraries/FFat/examples/FFat_Test/FFat_Test.ino

      This worked - just make sure not to reformat the drive each time.

      #include "FS.h"
      #include "FFat.h"
      
      // This file should be compiled with 'Partition Scheme' (in Tools menu)
      // set to 'Default with ffat' if you have a 4MB ESP32 dev module or
      // set to '16M Fat' if you have a 16MB ESP32 dev module.
      
      // You only need to format FFat the first time you run a test
      #define FORMAT_FFAT true
      
      void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
        Serial.printf("Listing directory: %s\r\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("\tSIZE: ");
            Serial.println(file.size());
          }
          file = root.openNextFile();
        }
      }
      
      void readFile(fs::FS &fs, const char *path) {
        Serial.printf("Reading file: %s\r\n", path);
      
        File file = fs.open(path);
        if (!file || file.isDirectory()) {
          Serial.println("- failed to open file for reading");
          return;
        }
      
        Serial.println("- 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\r\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\r\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\r\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\r\n", path);
        if (fs.remove(path)) {
          Serial.println("- file deleted");
        } else {
          Serial.println("- delete failed");
        }
      }
      
      void testFileIO(fs::FS &fs, const char *path) {
        Serial.printf("Testing file I/O with %s\r\n", path);
      
        static uint8_t buf[512];
        size_t len = 0;
        File file = fs.open(path, FILE_WRITE);
        if (!file) {
          Serial.println("- failed to open file for writing");
          return;
        }
      
        size_t i;
        Serial.print("- writing");
        uint32_t start = millis();
        for (i = 0; i < 2048; i++) {
          if ((i & 0x001F) == 0x001F) {
            Serial.print(".");
          }
          file.write(buf, 512);
        }
        Serial.println("");
        uint32_t end = millis() - start;
        Serial.printf(" - %u bytes written in %lu ms\r\n", 2048 * 512, end);
        file.close();
      
        file = fs.open(path);
        start = millis();
        end = start;
        i = 0;
        if (file && !file.isDirectory()) {
          len = file.size();
          size_t flen = len;
          start = millis();
          Serial.print("- reading");
          while (len) {
            size_t toRead = len;
            if (toRead > 512) {
              toRead = 512;
            }
            file.read(buf, toRead);
            if ((i++ & 0x001F) == 0x001F) {
              Serial.print(".");
            }
            len -= toRead;
          }
          Serial.println("");
          end = millis() - start;
          Serial.printf("- %u bytes read in %lu ms\r\n", flen, end);
          file.close();
        } else {
          Serial.println("- failed to open file for reading");
        }
      }
      
      void setup() {
        Serial.begin(115200);
        Serial.setDebugOutput(true);
        if (FORMAT_FFAT) {
          FFat.format();
        }
        if (!FFat.begin()) {
          Serial.println("FFat Mount Failed");
          return;
        }
      
        Serial.printf("Total space: %10u\n", FFat.totalBytes());
        Serial.printf("Free space: %10u\n", FFat.freeBytes());
        listDir(FFat, "/", 0);
        writeFile(FFat, "/hello.txt", "Hello ");
        appendFile(FFat, "/hello.txt", "World!\r\n");
        readFile(FFat, "/hello.txt");
        renameFile(FFat, "/hello.txt", "/foo.txt");
        readFile(FFat, "/foo.txt");
        deleteFile(FFat, "/foo.txt");
        testFileIO(FFat, "/test.txt");
        Serial.printf("Free space: %10u\n", FFat.freeBytes());
        deleteFile(FFat, "/test.txt");
        Serial.println("Test complete");
      }
      
      void loop() {}
      
      posted in Technical Discussion
      R
      rs77can
    • RE: SquareLine Studio - GUI Builder for LVGL

      @rs77can
      In the end - the software does not implement a complete list of all the widgets available in LVGL - specifically it did not have 'table' which i needed for my application.

      Hardcoded it manually, and works OK.

      It would have been a useful software if it was a little more complete.

      posted in Technical Discussion
      R
      rs77can

    Latest posts made by rs77can

    • RE: SquareLine Studio - GUI Builder for LVGL

      @rs77can
      In the end - the software does not implement a complete list of all the widgets available in LVGL - specifically it did not have 'table' which i needed for my application.

      Hardcoded it manually, and works OK.

      It would have been a useful software if it was a little more complete.

      posted in Technical Discussion
      R
      rs77can
    • RE: AMOLED S3 Touch - I2C port interference with QWIIC port?

      @teastain2

      Thanks, I realize that I can change the definitions of Wire to the other pin, but then would the Touch display not function appropriately?

      I would prefer to define GPIO2 and GPIO3 as Wire1 and not Wire, and have the touch display use that interface. I would then define Wire as the new pins (as per your example above).

      Is there a software option to do this? I am using some libraries that are hardcoded to Wire, and don't want to manually change them myself.

      If not possible, the Mutex method around the lv_task_handler() seems to work well - the board has been running for about 2 weeks with no issues, and no bad data.

      posted in Technical Discussion
      R
      rs77can
    • RE: AMOLED S3 Touch - I2C port interference with QWIIC port?

      @rs77can

      I was lopoking at these 2 pieces of the schematic

      touch.jpg Qwiic.jpg

      The top is the touch interface, and the bottom is the Qwiic port - they both seem to be using the same GPIO2/3

      U0RXD U0TXD (44/43) are the RS232 Serial connections - no?

      posted in Technical Discussion
      R
      rs77can
    • AMOLED S3 Touch - I2C port interference with QWIIC port?

      Does the touch display use the same I2C interface as is on the STEMMA / QWIIC connector?

      I am getting some random I2C error reading some devices.

      By the schematic, it appears that that is the case. I am using a mutex in FreeRTOS to access the I2C port between several tasks. Is there a way to make sure lvgl uses the same mutex before accessing the port?

      I am trying to solve it by adding a Take and Give for my mutex around each access to lv_task_handler(), but not sure if that is the way to go

      void do_lv_task_handler() {
        xSemaphoreTake(I2C_Mutex, portMAX_DELAY);
        lv_task_handler();
        xSemaphoreGive(I2C_Mutex);
      }
      
      posted in Technical Discussion
      R
      rs77can
    • RE: AMOLED S3 T-Display Touch - Problem with reading SD Card

      @rs77can That did not work either - cant mount card

      I tried this

      https://github.com/espressif/arduino-esp32/blob/master/libraries/FFat/examples/FFat_Test/FFat_Test.ino

      This worked - just make sure not to reformat the drive each time.

      #include "FS.h"
      #include "FFat.h"
      
      // This file should be compiled with 'Partition Scheme' (in Tools menu)
      // set to 'Default with ffat' if you have a 4MB ESP32 dev module or
      // set to '16M Fat' if you have a 16MB ESP32 dev module.
      
      // You only need to format FFat the first time you run a test
      #define FORMAT_FFAT true
      
      void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
        Serial.printf("Listing directory: %s\r\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("\tSIZE: ");
            Serial.println(file.size());
          }
          file = root.openNextFile();
        }
      }
      
      void readFile(fs::FS &fs, const char *path) {
        Serial.printf("Reading file: %s\r\n", path);
      
        File file = fs.open(path);
        if (!file || file.isDirectory()) {
          Serial.println("- failed to open file for reading");
          return;
        }
      
        Serial.println("- 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\r\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\r\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\r\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\r\n", path);
        if (fs.remove(path)) {
          Serial.println("- file deleted");
        } else {
          Serial.println("- delete failed");
        }
      }
      
      void testFileIO(fs::FS &fs, const char *path) {
        Serial.printf("Testing file I/O with %s\r\n", path);
      
        static uint8_t buf[512];
        size_t len = 0;
        File file = fs.open(path, FILE_WRITE);
        if (!file) {
          Serial.println("- failed to open file for writing");
          return;
        }
      
        size_t i;
        Serial.print("- writing");
        uint32_t start = millis();
        for (i = 0; i < 2048; i++) {
          if ((i & 0x001F) == 0x001F) {
            Serial.print(".");
          }
          file.write(buf, 512);
        }
        Serial.println("");
        uint32_t end = millis() - start;
        Serial.printf(" - %u bytes written in %lu ms\r\n", 2048 * 512, end);
        file.close();
      
        file = fs.open(path);
        start = millis();
        end = start;
        i = 0;
        if (file && !file.isDirectory()) {
          len = file.size();
          size_t flen = len;
          start = millis();
          Serial.print("- reading");
          while (len) {
            size_t toRead = len;
            if (toRead > 512) {
              toRead = 512;
            }
            file.read(buf, toRead);
            if ((i++ & 0x001F) == 0x001F) {
              Serial.print(".");
            }
            len -= toRead;
          }
          Serial.println("");
          end = millis() - start;
          Serial.printf("- %u bytes read in %lu ms\r\n", flen, end);
          file.close();
        } else {
          Serial.println("- failed to open file for reading");
        }
      }
      
      void setup() {
        Serial.begin(115200);
        Serial.setDebugOutput(true);
        if (FORMAT_FFAT) {
          FFat.format();
        }
        if (!FFat.begin()) {
          Serial.println("FFat Mount Failed");
          return;
        }
      
        Serial.printf("Total space: %10u\n", FFat.totalBytes());
        Serial.printf("Free space: %10u\n", FFat.freeBytes());
        listDir(FFat, "/", 0);
        writeFile(FFat, "/hello.txt", "Hello ");
        appendFile(FFat, "/hello.txt", "World!\r\n");
        readFile(FFat, "/hello.txt");
        renameFile(FFat, "/hello.txt", "/foo.txt");
        readFile(FFat, "/foo.txt");
        deleteFile(FFat, "/foo.txt");
        testFileIO(FFat, "/test.txt");
        Serial.printf("Free space: %10u\n", FFat.freeBytes());
        deleteFile(FFat, "/test.txt");
        Serial.println("Test complete");
      }
      
      void loop() {}
      
      posted in Technical Discussion
      R
      rs77can
    • AMOLED S3 T-Display Touch - Problem with reading SD Card

      I need to have the WiFi, the AMOLED display, as well as the SD card all working simultaneously.

      I am using Arduino IDE

      The examples for the SD card interface do not work, and generate an error that the SD card cannot be mounted.

      I tried

      https://community.lilygo.cc/topic/154/t-display-s3-touch-version-trouble-to-connect-sd-card-reader-spi

      Anyone have a working example

      posted in Technical Discussion
      R
      rs77can
    • SquareLine Studio - GUI Builder for LVGL

      Has anyone used this software to build GUIs for the AMOLED S3

      Any success?

      posted in Technical Discussion
      R
      rs77can