Closed petercipov closed 8 months ago
I would also suggest to decrease frequency to 8-10MHz for testing.
Can you post link to sd card module, or picture of it, please.
I am using microSD Card modul SPI 3.3V, datasheet SD-MINI.pdf
I have tried host.max_freq_khz = SDMMC_FREQ_PROBING;
no working
I have connected logic analyser and decoded spi, and found same as in debug logs, those commands are unssuported by microsd card
I have tried to create my own module https://www.mischianti.org/2019/12/15/how-to-use-sd-card-with-esp8266-and-arduino/ , got same issue with unssuported command 52 and 5
I have created bug here as then I tried my last option - try different sd cards (mentioned above) and they work flawlesly. I see this as an issue in a driver.
@petercipov Could you please save and attach here the data captured by the logic analyzer?
CMD5 and CMD52 are indeed unsupported by memory cards (these are SDIO commands) but this shouldn't influence subsequent initialization (per standard, at least...) I'd like to see what happens later in the initialization process, maybe there is some other issue.
By the way, you can also check if indeed sending the IO commands causes this card to fail during initialization. To do this, delete two lines:
and
then try to run the example again.
Hello @igrr ,
here is dslogic file with full communication (using dsview 1.1.2)
I have recompiled firmware with commenting those two commands, got different error
␛[0;32mI (29) boot: ESP-IDF 3.40200.210118 2nd stage bootloader␛[0m
␛[0;32mI (29) boot: compile time 19:16:16␛[0m
␛[0;32mI (29) boot: chip revision: 1␛[0m
␛[0;32mI (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0␛[0m
␛[0;32mI (39) boot.esp32: SPI Speed : 40MHz␛[0m
␛[0;32mI (44) boot.esp32: SPI Mode : DIO␛[0m
␛[0;32mI (48) boot.esp32: SPI Flash Size : 4MB␛[0m
␛[0;32mI (53) boot: Enabling RNG early entropy source...␛[0m
␛[0;32mI (58) boot: Partition Table:␛[0m
␛[0;32mI (62) boot: ## Label Usage Type ST Offset Length␛[0m
␛[0;32mI (69) boot: 0 nvs WiFi data 01 02 00009000 00006000␛[0m
␛[0;32mI (77) boot: 1 phy_init RF data 01 01 0000f000 00001000␛[0m
␛[0;32mI (84) boot: 2 factory factory app 00 00 00010000 00100000␛[0m
␛[0;32mI (92) boot: End of partition table␛[0m
␛[0;32mI (96) boot_comm: chip revision: 1, min. application chip revision: 0␛[0m
␛[0;32mI (103) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x0a98c ( 43404) map␛[0m
␛[0;32mI (130) esp_image: segment 1: paddr=0x0001a9b4 vaddr=0x3ffb0000 size=0x021c8 ( 8648) load␛[0m
␛[0;32mI (134) esp_image: segment 2: paddr=0x0001cb84 vaddr=0x40080000 size=0x00404 ( 1028) load␛[0m
␛[0;32mI (137) esp_image: segment 3: paddr=0x0001cf90 vaddr=0x40080404 size=0x03088 ( 12424) load␛[0m
␛[0;32mI (152) esp_image: segment 4: paddr=0x00020020 vaddr=0x400d0020 size=0x1de64 (122468) map␛[0m
␛[0;32mI (206) esp_image: segment 5: paddr=0x0003de8c vaddr=0x4008348c size=0x08a44 ( 35396) load␛[0m
␛[0;32mI (230) boot: Loaded app from partition at offset 0x10000␛[0m
␛[0;32mI (230) boot: Disabling RNG early entropy source...␛[0m
␛[0;32mI (230) cpu_start: Pro cpu up.␛[0m
␛[0;32mI (234) cpu_start: Application information:␛[0m
␛[0;32mI (239) cpu_start: Project name: sdcard-demo␛[0m
␛[0;32mI (244) cpu_start: App version: 0771137␛[0m
␛[0;32mI (249) cpu_start: Compile time: Mar 10 2021 19:13:22␛[0m
␛[0;32mI (255) cpu_start: ELF file SHA256: 9bfe1305702e822c...␛[0m
␛[0;32mI (261) cpu_start: ESP-IDF: 3.40200.210118␛[0m
␛[0;32mI (267) cpu_start: Starting app cpu, entry point is 0x40081fb0␛[0m
␛[0;32mI (0) cpu_start: App cpu up.␛[0m
␛[0;32mI (277) heap_init: Initializing. RAM available for dynamic allocation:␛[0m
␛[0;32mI (284) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM␛[0m
␛[0;32mI (290) heap_init: At 3FFB2A68 len 0002D598 (181 KiB): DRAM␛[0m
␛[0;32mI (296) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM␛[0m
␛[0;32mI (303) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM␛[0m
␛[0;32mI (309) heap_init: At 4008BED0 len 00014130 (80 KiB): IRAM␛[0m
␛[0;32mI (315) cpu_start: Pro cpu start user code␛[0m
␛[0;32mI (334) spi_flash: detected chip: generic␛[0m
␛[0;32mI (334) spi_flash: flash io: dio␛[0m
␛[0;32mI (334) cpu_start: Starting scheduler on PRO CPU.␛[0m
␛[0;32mI (0) cpu_start: Starting scheduler on APP CPU.␛[0m
␛[0;32mI (342) example: Initializing SD card␛[0m
␛[0;32mI (342) example: Using SPI peripheral␛[0m
␛[0;32mI (352) example: Attaching FS␛[0m
␛[0;32mI (352) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 ␛[0m
␛[0;33mW (402) vfs_fat_sdmmc: failed to mount card (1)␛[0m
␛[0;31mE (402) vfs_fat_sdmmc: mount_to_vfs failed (0xffffffff).␛[0m
␛[0;32mI (402) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 ␛[0m
␛[0;31mE (412) example: Failed to mount filesystem. If you want the card to be formatted, set the EXAMPLE_FORMAT_IF_MOUNT_FAILED menuconfig option.␛[0m
I have set EXAMPLE_FORMAT_IF_MOUNT_FAILED to also to true, but got same error.
Hi @petercipov, sorry for not replying sooner. So far I have managed to get the same model of the card and to reproduce the issue. Unfortunately, I haven't been able to figure out what makes this specific card model to time out replying to SEND_OP_COND command, yet. Will let you know when there is some progress.
I can confirm regression in master branch. Tested the same example and exactly the same hardware, including sd card, with master branch 1067b28707e527f177752741e3aa08b5dc64a4d7 and b0150615dff529662772a60dcb57d5b559f480e2 This commit works: b0150615dff529662772a60dcb57d5b559f480e2 this commit does not works 1067b28707e527f177752741e3aa08b5dc64a4d7
I am reporting here due to cmd 52
I (333) example: Using SPI peripheral
I (333) gpio: GPIO[40]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (343) sdspi_transaction: cmd=52, R1 response: command CRC error
E (353) sdmmc_io: sdmmc_io_reset: unexpected return: 0x109
E (363) vfs_fat_sdmmc: sdmmc_card_init failed (0x109).
I (363) gpio: GPIO[40]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
E (373) example: Failed to initialize the card (ESP_ERR_INVALID_CRC). Make sure SD card lines have pull-up resistors in place.
board: S2 saola esp-idf commit: see above code: sd_card example
EDIT in my case it was very small issue with USB cable (lose connection)
Hello. I'm new in this discouus.
I'am using the driver SDSPI by esp-tool and when I off my device and I up I have this issue:
I (315) spi_flash: detected chip: generic I (318) spi_flash: flash io: dio W (322) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header. I (336) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU. I (346) example: Initializing SD card I (346) example: Using SPI peripheral I (356) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 I (366) sdspi_transaction: cmd=52, R1 response: command not supported I (416) sdspi_transaction: cmd=5, R1 response: command not supported E (1416) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107 E (1416) vfs_fat_sdmmc: sdmmc_card_init failed (0x107). I (1416) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 E (1426) example: Failed to initialize the card (ESP_ERR_TIMEOUT). Make sure SD card lines have pull-up resistors in place.
can some one help me, please?
and I have another question.
in this driver, How can I to open a file?
I'm using an task to open the file but I have this issue;
E (1126) example: Failed to open file for writing E (1136) FreeRTOS: FreeRTOS Task "Prueba_sdcard_t" should not return, Aborting now!
Thank you
Environment
git describe --tags
to find it): platformio/framework-espidf 3.40200.210118 @ ~3.40200.0Problem Description
Using 64 GB micro sd card (Kingston MicroSDXC 64GB Canvas Go! Plus)does not work with example code https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card This sd card works well with arduino uno and is well formatted with fat32
I am using 3.3 V micro sd card module to connect to esp32 board.
I have tried 32 GB (Samsung MicroSDHC 32GB EVO Plus) and 16GB (SanDisk MicroSDHC 16GB Ultra Android) micro sd card. Both works as expected
I have spotted in logs that spi commands (52 and 5) are not supported by particular 64 GB card.
Expected Behavior
example code works with 64 Gb micro sd card or update documentation that such cards are not supported.
Actual Behavior
Failed to initialize the card
Steps to reproduce
Debug Logs