🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Core2 and SD-Card stack challenge

    ESP - IDF
    1
    1
    4.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sheepDog
      last edited by sheepDog

      Hello,

      I used ESP-IDF v4.4-beta1, Arduino 2.0.2 for and M5Core2-Library ("0.1.0" = newest version, I also checked 0.0.3). The Arduino libraries I got from "https://github.com/espressif/arduino-esp32.git" and the M5Core2 Library I loaded from "https://github.com/m5stack/M5Core2.git".

      I can initialize the M5Core2, write text on the screen and connect to wifi. If I activated the SD-Card I got an error: "A stack overflow in task main has been detected."

      I looked for the cause and it are these calls:

      bool SD_Enabler = true;
      M5.begin(true, SD_Enabler, true, false, kMBusModeInput); 
         -> SD.begin(TFCARD_CS_PIN, SPI, 40000000);
            -> if(!sdcard_mount(_pdrv, mountpoint, max_files, format_if_empty)){
                -> FRESULT res = f_mount(fs, drv, 1);
      

      The reason for the stack challenge is f_mount.
      There are only two parameters for this function:

      FATFS* fs;
      char drv[3] = {(char)('0' + pdrv), ':', 0};
      

      The value for drv is "0:" and seemed okay. The parameter fs was initialled some lines one before without an error:

        esp_err_t err = esp_vfs_fat_register(path, drv, max_files, &fs);
          if (err == ESP_ERR_INVALID_STATE) {
              log_e("esp_vfs_fat_register failed 0x(%x): SD is registered.", err);
              return false;
          } else if (err != ESP_OK) {
              log_e("esp_vfs_fat_register failed 0x(%x)", err);
              return false;
          }
      

      I didn't know what happened. Have anyone a good idea?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post