esp-idf: Problem with ESP32-S3 and eMMC (IDFGH-6615)
Hello,
I’m using esp32-s3 and a MicroSD card adapter, with these connections(SDMMC_HOST_FLAG_1BIT):
- CLK: GPIO_NUM_14
- CMD: GPIO_NUM_15
- D0: GPIO_NUM_2
and this is my code:
sdmmc_card_t *card;
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
host.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
host.flags = SDMMC_HOST_FLAG_1BIT;
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
sdmmc_host_init_slot(SDMMC_HOST_SLOT_1, &slot_config);
gpio_pullup_en(GPIO_NUM_14);
gpio_pulldown_dis(GPIO_NUM_14);
gpio_pullup_en(GPIO_NUM_15);
gpio_pulldown_dis(GPIO_NUM_15);
gpio_pullup_en(GPIO_NUM_2);
gpio_pulldown_dis(GPIO_NUM_2);
gpio_pullup_en(GPIO_NUM_4);
gpio_pulldown_dis(GPIO_NUM_4);
gpio_pullup_en(GPIO_NUM_12);
gpio_pulldown_dis(GPIO_NUM_12);
gpio_pullup_en(GPIO_NUM_13);
gpio_pulldown_dis(GPIO_NUM_13);
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
.format_if_mount_failed = false,
.max_files = 5,
};
esp_err_t ret = esp_vfs_fat_sdmmc_mount("/root", &host, &slot_config, &mount_config, &card);
The problem is that I have these errors (and the esp_vfs_fat_sdmmc_mount return always error=0x107):
E (3193) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107 E (3193) vfs_fat_sdmmc: sdmmc_card_init failed (0x107). Failed to initialize the card. Make sure SD card lines have pull-up resistors in place.
I have done also the eFuse, but nothing change…
With esp32-wroom32 and esp32-pico mini I have no problem with the same code and wire.
please could you help me?
Thanks
Simeon
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 38 (15 by maintainers)
Commits related to this issue
- sdmmc: I/O phase adjustments 1. Fix incorrect meaning of SDMMC.clock bits, synchronize the names with the TRM. 2. Choose input and output phases to satisfy typical timing requirements. 3. Move ... — committed to espressif/esp-idf by igrr 2 years ago
- sdmmc: I/O phase adjustments 1. Fix incorrect meaning of SDMMC.clock bits, synchronize the names with the TRM. 2. Choose input and output phases to satisfy typical timing requirements. 3. Move ... — committed to espressif/esp-idf by Icarus113 a year ago
- sdmmc: I/O phase adjustments 1. Fix incorrect meaning of SDMMC.clock bits, synchronize the names with the TRM. 2. Choose input and output phases to satisfy typical timing requirements. 3. Move ... — committed to espressif/esp-idf by igrr 2 years ago
- sdmmc: I/O phase adjustments 1. Fix incorrect meaning of SDMMC.clock bits, synchronize the names with the TRM. 2. Choose input and output phases to satisfy typical timing requirements. 3. Move ... — committed to espressif/esp-idf by Icarus113 a year ago
Hi @simeondmr, @lorenzopeluso, @vmastellone. Just letting you know that I have reproduced the issue and I will try to provide some patch to you soon.
@fito-jaeuklee Disabling SDMMC_HOST_FLAG_DDR in host flags will disable the DDR mode for eMMC, which indeed can work around some of the signal integrity issues!
The standard devkit doesn’t have a built-in eMMC, so I doubt it can work well — the only way to use it is to connect eMMC using some jumper cables, which results in rather long wires going between two boards. This may cause signal integrity issues.
Right now Espressif has one official ESP32-S3 board with 4-line SD interface: ESP32-S3-USB-OTG. It is possible to use this USB-OTG board with an eMMC-to-microSD adapter like the one in your photo. However, as of now, the same issue can be reproduced when using ESP32-S3-USB-OTG with an eMMC breakout board.
Made some progress getting highspeed mode to work in a parallel issue: https://github.com/espressif/esp-idf/issues/8521. I hope to post a patch for eMMC (including DDR mode) soon.
ESP32-S3 has different timing of the SDMMC peripheral since the signals now go through GPIO matrix, so the fact that ESP32 works in the same conditions is not really important.
Could you describe the connections between ESP32-S3 and eMMC chip? Are both on a PCB or you are connecting them by some cables?
If it works with SD but fails with eMMC then it could be a timing issue. Does it work with eMMC at lower frequency? I.e. if you remove
host.max_freq_khz = SDMMC_FREQ_HIGHSPEED;line? Do you have a logic analyzer or an oscilloscope to capture the signals between ESP32-S3 and eMMC and verify timing and signal integrity?Hi @simeondmr, for ESP32-S3, SD card pins need to be configured explicitly, since SDMMC peripheral now works with arbitrary GPIOs. The docs have just been updated, please see https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/sdmmc_host.html#configuring-gpios.
You probably need something along these lines: