-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SDMMC] ESP32-S3-N8R8 fails to start a microSD card in SDMMC_FREQ_HIGHSPEED mode (IDFGH-6901) #8521
Comments
I'm seeing the same issue with an N8R8 devkit and also on a custom PCB with an WROOM-N8R2 or WROOM-N8R8. The PCB has an SPI bus running at 80MHz without issue, so it's not a problem with the trace lengths. |
@ThanosSiopoudis @ntwallace Thank you for reporting the issue! Could you please try to apply the attached patch and see if it improves the situation? |
Thanks @igrr, I've applied the patch and I can confirm that it now consistently starts at 40MHz and no read errors are observed (I did not test extensively however).
|
Hey all, I think I might have a similar issue. I'm using an ESP32-S3 as well (specifically the ESP32-S3-DevKitC-1) and can't get it to talk to a microSD card. Card's connected over the following pins:
I'm getting the same error message that ThanosSlopoudis is in the initial issue, however, applying Igor's patch did not fix the issue for me. The only difference I've noticed is that I haven't yet tried esp-idf version: 5963de1 plus Igor's patch from above Full code: 39 esp_err_t autoconfigure_usd_card(void) {
40 esp_err_t err;
41 #if USDLOG_USE_ADV_MOUNT // false
42 err = configure_usd_card();
43 #else
44 ESP_LOGW(SDTAG, "proceeding without SD card error checking!");
45 setup_spi();
46 esp_vfs_fat_sdmmc_mount_config_t mount_config = {
47 #if USDLOG_FORMAT_IF_MOUNT_FAIL
48 .format_if_mount_failed = true,
49 #else
50 .format_if_mount_failed = false,
51 #endif
52 .max_files = MAX_OPEN_FILES,
53 .allocation_unit_size = ALLOC_UNIT_SIZE
54 };
55 // do not init -- output pointer argument
56 sdmmc_card_t *card;
57 const char mountpoint[] = MOUNTPOINT;
58 sdspi_device_config_t slot_config = {
59 .host_id = SPI2_HOST,
60 .gpio_cs = USDLOG_PIN_CS,
61 .gpio_cd = SDSPI_SLOT_NO_CD,
62 .gpio_wp = SDSPI_SLOT_NO_WP,
63 .gpio_int = SDSPI_SLOT_NO_INT
64 };
65 sdmmc_host_t host = SDSPI_HOST_DEFAULT();
66 slot_config.host_id = host.slot;
67
68 err = esp_vfs_fat_sdspi_mount(
69 mountpoint,
70 &host,
71 &slot_config,
72 &mount_config,
73 &card);
74 #endif
75 if (err == ESP_OK) {
76 sdmmc_card_print_info(stdout, card);
77 }
78 return err;
79 } (the whole Apologies if my code makes no sense -- it's seen better days :) |
@mishaturnbull I'm sorry, this issue isn't related to the problem you are seeing. Your code uses sdspi driver while this issue is about sdmmc. My patch won't help because it modifies the sdmmc driver. Please try to run examples/storage/sd_card/sdspi from the master branch, adjusting the pins in menuconfig for your hardware. If that doesn't work, please open new issue and post the details, including console output at debug log level. Thanks! |
Hi @igrr In my Arduino code following the SDMMC test example; https://github.com/espressif/arduino-esp32/blob/master/libraries/SD_MMC/examples/SDMMC_Test/SDMMC_Test.ino for our custom designed ESP32S3Wroom1u with 16 MB of flash and OPI PSRAM I have added the following to set pins if(!SD_MMC.setPins(47, 48, 39, 40, 0, 38)){ // added setting pins and testing if SDMMCFS class bool setPins() returns False when setting pins #define SOC_SDMMC_USE_GPIO_MATRIX; But for
E (212) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107 Any comments on how to fix this issue? |
@Paryavi It seems that the card init fails at a very early stage. I think it's unrelated to the issue of high-speed mode being discussed here. |
I ran into this issue as well with my PCB with a N32R8V module. The patch posted above fixed it and it now seems to mount every time. |
@igrr Can this patch be applied to Stable 4.4.2? Facing the same issue with ESP32-S3-N8. Compiling with latest master is ok, compiling with 4.4.2 can only mount if 20 MHz and always fails on 40 MHz. Using SDMMC/4-bit. We must use the 4.4.2 as the ESP-ADF is not yet fully supported with v5.1 latest (any time frame for v5 to support ADF? or patches?) Thanks |
Hi, I was just testing my custom PCB (ESP32-S3 Mini) with an eMMC (eMMC_Samsung-KLMAG1JETD-B041) and also run into the 0x109 error. My ESP-IDF version: ESP-IDF v5.1-dev-1384-g7052a14d61-dirty. Applying the patch ( For the 1-bit / 40MHz, I can omit the Is there maybe a more permanent fix to be expected? |
Hi @Paryavi ,
Applying the patch didn't work. Microsd formatted as fat32 and exfat, same negative result. Microsd_det works correctly. Speed is 10kHz. Thanks in advance. |
Environment
git describe --tags
to find it): v5.0-dev-1867-g5faf116d26xtensa-esp32-elf-gcc --version
to find it): xtensa-esp32-elf-gcc (crosstool-NG esp-2021r2-patch3) 8.4.0Problem Description
ESP32-S3-WROOM-1-N8R8 module has trouble with microSD cards at 40MHz / 4-line mode. I have tried both an ESP32-S3-DEVKITC-1-N8R8 and an ESP32-S3-WROOM-1-N8R8 module on a printed circuit board.
The PCB is populated with 10KOhm pull-ups on CMD and D0-D3 lines (and I also tried adding an extra pull-up on the CLK line).
The Devkit was tested with just the internal weak pull-ups enabled.
In both cases, and after trying numerous brands, sizes and speed-rated microSD cards, I have found that they can rarely start at 40MHz (
SDMMC_FREQ_HIGHSPEED
) mode, and when they do, there are block read errors observed.Expected Behavior
Expected the microSD card to start in HIGHSPEED mode.
Actual Behavior
Most of the times, the card fails to start in 40MHz mode with the following errors:
After resetting, it can sometimes start at 40MHz, but when proceeding to read data, block read errors eventually occur:
Starting the cards at 20MHz mode works fine with no errors.
Steps to reproduce
Code to reproduce this issue
Debug Logs
Other items if possible
sdkconfig.zip
The text was updated successfully, but these errors were encountered: