SDMMC
Posted: Sun May 10, 2020 1:28 pm
Hi all,
i’m trying to use the sd_mmc to read sdcard (1bit mode && 4 bit mode) with esp32, i have my own board,
pin are connected as standard (like the esprover kit 4.1, but without diode), i have pullup (10k) on
SD_dat0 (io2),
sd_dat1 (io4),
sd_dat2 (io12),
sd_dat3 (io13),
sd_cmd (io15),
sd_clk (ioio14),
sd_cd (io34)
the code initalize pins:
pinMode(SD_DAT3, PULLUP); // 13
pinMode(SD_CMD, PULLUP); // 15
pinMode(SD_DAT0, PULLUP); // 2
pinMode(SD_DAT1, PULLUP); // 4
pinMode(SD_DAT2, PULLUP); // 12
bool card_present = SD_MMC.begin("/sdcard", true);
if (!card_present)
{
Serial.println("Card Mount Failed");
return;
}
the error is:
E (859) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107
[E][SD_MMC.cpp:97] begin(): Failed to initialize the card (263). Make sure SD card lines have pull-up resistors in place.
i read a lot on internet about this problem,
i not have wire, connector soldered directly to my board
set registry on esp32 to 3.3v (espefuse.py --port com7 set_flash_voltage 3.3V)
the pins use for sd-card are used only for sd-card, nothing more attached
put togheter io2+io2 (not functioning)
tried with 2 equals sd-card (16gb sdhc) formatted fat32 with partition of 512mb (noluck)
tried with another type (8gb) formatted fat32 with partition 512mb (no luck)
set SD_MMC.begin parameters for 1bit or 4bit
changed in SD_MCC.cpp:
line 62 to -> host.max_freq_khz = SDMMC_FREQ_PROBING
to power the board not use usb
tried to set SPI prior initialize sdmmc
i'm doing all this inside platformio/arduino, i had also another project with espressif IDF to check is there are the same problem, and yes is the same, this is the log:
(i do cut&paste of https://github.com/espressif/esp-idf/bl ... ple_main.c
set
slot_config.width = 1;
host.max_freq_khz = SDMMC_FREQ_PROBING;//SDMMC_FREQ_HIGHSPEED;
host.flags = SDMMC_HOST_FLAG_1BIT;
)
15:17:52.423 > rst:0x1 (POWERON_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
15:17:52.439 > ets Jun 8 2016 00:22:57
15:17:52.839 >
15:17:52.839 > rst:0x10 (RTCWDT_RTC_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
15:17:52.839 > configsip: 0, SPIWP:0xee
15:17:52.839 > clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
15:17:52.855 > mode:DIO, clock div:2
15:17:52.855 > load:0x3fff0018,len:4
15:17:52.855 > load:0x3fff001c,len:7012
15:17:52.855 > load:0x40078000,len:14076
15:17:52.855 > load:0x40080400,len:4304
15:17:52.871 > entry 0x400806e8
15:17:52.871 > ␛[0;32mI (72) boot: Chip Revision: 0␛[0m
15:17:52.871 > ␛[0;32mI (32) boot: ESP-IDF GIT-NOTFOUND 2nd stage bootloader␛[0m
15:17:52.871 > ␛[0;32mI (32) boot: compile time 12:20:24␛[0m
15:17:52.887 > ␛[0;32mI (32) boot: Enabling RNG early entropy source...␛[0m
15:17:52.887 > ␛[0;32mI (37) boot: SPI Speed : 40MHz␛[0m
15:17:52.887 > ␛[0;32mI (42) boot: SPI Mode : DIO␛[0m
15:17:52.887 > ␛[0;32mI (46) boot: SPI Flash Size : 4MB␛[0m
15:17:52.904 > ␛[0;32mI (50) boot: Partition Table:␛[0m
15:17:52.904 > ␛[0;32mI (53) boot: ## Label Usage Type ST Offset Length␛[0m
15:17:52.904 > ␛[0;32mI (60) boot: 0 nvs WiFi data 01 02 00009000 00006000␛[0m
15:17:52.919 > ␛[0;32mI (68) boot: 1 phy_init RF data 01 01 0000f000 00001000␛[0m
15:17:52.919 > ␛[0;32mI (75) boot: 2 factory factory app 00 00 00010000 00100000␛[0m
15:17:52.935 > ␛[0;32mI (83) boot: End of partition table␛[0m
15:17:52.935 > ␛[0;32mI (87) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x09928 ( 39208) map␛[0m
15:17:52.951 > ␛[0;32mI (110) esp_image: segment 1: paddr=0x00019950 vaddr=0x3ffb0000 size=0x02154 ( 8532) load␛[0m
15:17:52.951 > ␛[0;32mI (114) esp_image: segment 2: paddr=0x0001baac vaddr=0x40080000 size=0x00400 ( 1024) load␛[0m
15:17:52.967 > ␛[0;32mI (117) esp_image: segment 3: paddr=0x0001beb4 vaddr=0x40080400 size=0x0415c ( 16732) load␛[0m
15:17:52.967 > ␛[0;32mI (133) esp_image: segment 4: paddr=0x00020018 vaddr=0x400d0018 size=0x1c5a8 (116136) map␛[0m
15:17:52.983 > ␛[0;32mI (176) esp_image: segment 5: paddr=0x0003c5c8 vaddr=0x4008455c size=0x06148 ( 24904) load␛[0m
15:17:53.016 > ␛[0;32mI (193) boot: Loaded app from partition at offset 0x10000␛[0m
15:17:53.031 > ␛[0;32mI (194) boot: Disabling RNG early entropy source...␛[0m
15:17:53.047 > ␛[0;32mI (194) cpu_start: Pro cpu up.␛[0m
15:17:53.047 > ␛[0;32mI (198) cpu_start: Application information:␛[0m
15:17:53.047 > ␛[0;32mI (202) cpu_start: Project name: test_mmc_idf␛[0m
15:17:53.063 > ␛[0;32mI (208) cpu_start: App version: 1␛[0m
15:17:53.063 > ␛[0;32mI (212) cpu_start: Compile time: May 10 2020 12:19:59␛[0m
15:17:53.063 > ␛[0;32mI (218) cpu_start: ELF file SHA256: 3bafca7d9efc3e1b...␛[0m
15:17:53.079 > ␛[0;32mI (224) cpu_start: ESP-IDF: GIT-NOTFOUND␛[0m
15:17:53.079 > ␛[0;32mI (230) cpu_start: Starting app cpu, entry point is 0x40081384␛[0m
15:17:53.079 > ␛[0;32mI (0) cpu_start: App cpu up.␛[0m
15:17:53.095 > ␛[0;32mI (240) heap_init: Initializing. RAM available for dynamic allocation:␛[0m
15:17:53.095 > ␛[0;32mI (247) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM␛[0m
15:17:53.095 > ␛[0;32mI (253) heap_init: At 3FFB3250 len 0002CDB0 (179 KiB): DRAM␛[0m
15:17:53.112 > ␛[0;32mI (259) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM␛[0m
15:17:53.112 > ␛[0;32mI (266) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM␛[0m
15:17:53.127 > ␛[0;32mI (272) heap_init: At 4008A6A4 len 0001595C (86 KiB): IRAM␛[0m
15:17:53.127 > ␛[0;32mI (278) cpu_start: Pro cpu start user code␛[0m
15:17:53.127 > ␛[0;32mI (297) spi_flash: detected chip: gd␛[0m
15:17:53.143 > ␛[0;32mI (297) spi_flash: flash io: dio␛[0m
15:17:53.143 > ␛[0;32mI (297) cpu_start: Starting scheduler on PRO CPU.␛[0m
15:17:53.143 > ␛[0;32mI (0) cpu_start: Starting scheduler on APP CPU.␛[0m
15:17:53.160 > ␛[0;32mI (305) example: Initializing SD card␛[0m
15:17:53.160 > ␛[0;32mI (305) example: Using SDMMC peripheral␛[0m
15:17:53.160 > ␛[0;31mE (335) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107␛[0m
15:17:53.176 > ␛[0;31mE (335) example: Failed to initialize the card (ESP_ERR_TIMEOUT). Make sure SD card lines have pull-up resistors in place.␛[0m
i have loosed many days to find solution
i not know what else try or what can be, no ideas at the moment
someone can try to point me in the right direction?
thanks
i’m trying to use the sd_mmc to read sdcard (1bit mode && 4 bit mode) with esp32, i have my own board,
pin are connected as standard (like the esprover kit 4.1, but without diode), i have pullup (10k) on
SD_dat0 (io2),
sd_dat1 (io4),
sd_dat2 (io12),
sd_dat3 (io13),
sd_cmd (io15),
sd_clk (ioio14),
sd_cd (io34)
the code initalize pins:
pinMode(SD_DAT3, PULLUP); // 13
pinMode(SD_CMD, PULLUP); // 15
pinMode(SD_DAT0, PULLUP); // 2
pinMode(SD_DAT1, PULLUP); // 4
pinMode(SD_DAT2, PULLUP); // 12
bool card_present = SD_MMC.begin("/sdcard", true);
if (!card_present)
{
Serial.println("Card Mount Failed");
return;
}
the error is:
E (859) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107
[E][SD_MMC.cpp:97] begin(): Failed to initialize the card (263). Make sure SD card lines have pull-up resistors in place.
i read a lot on internet about this problem,
i not have wire, connector soldered directly to my board
set registry on esp32 to 3.3v (espefuse.py --port com7 set_flash_voltage 3.3V)
the pins use for sd-card are used only for sd-card, nothing more attached
put togheter io2+io2 (not functioning)
tried with 2 equals sd-card (16gb sdhc) formatted fat32 with partition of 512mb (noluck)
tried with another type (8gb) formatted fat32 with partition 512mb (no luck)
set SD_MMC.begin parameters for 1bit or 4bit
changed in SD_MCC.cpp:
line 62 to -> host.max_freq_khz = SDMMC_FREQ_PROBING
to power the board not use usb
tried to set SPI prior initialize sdmmc
i'm doing all this inside platformio/arduino, i had also another project with espressif IDF to check is there are the same problem, and yes is the same, this is the log:
(i do cut&paste of https://github.com/espressif/esp-idf/bl ... ple_main.c
set
slot_config.width = 1;
host.max_freq_khz = SDMMC_FREQ_PROBING;//SDMMC_FREQ_HIGHSPEED;
host.flags = SDMMC_HOST_FLAG_1BIT;
)
15:17:52.423 > rst:0x1 (POWERON_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
15:17:52.439 > ets Jun 8 2016 00:22:57
15:17:52.839 >
15:17:52.839 > rst:0x10 (RTCWDT_RTC_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
15:17:52.839 > configsip: 0, SPIWP:0xee
15:17:52.839 > clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
15:17:52.855 > mode:DIO, clock div:2
15:17:52.855 > load:0x3fff0018,len:4
15:17:52.855 > load:0x3fff001c,len:7012
15:17:52.855 > load:0x40078000,len:14076
15:17:52.855 > load:0x40080400,len:4304
15:17:52.871 > entry 0x400806e8
15:17:52.871 > ␛[0;32mI (72) boot: Chip Revision: 0␛[0m
15:17:52.871 > ␛[0;32mI (32) boot: ESP-IDF GIT-NOTFOUND 2nd stage bootloader␛[0m
15:17:52.871 > ␛[0;32mI (32) boot: compile time 12:20:24␛[0m
15:17:52.887 > ␛[0;32mI (32) boot: Enabling RNG early entropy source...␛[0m
15:17:52.887 > ␛[0;32mI (37) boot: SPI Speed : 40MHz␛[0m
15:17:52.887 > ␛[0;32mI (42) boot: SPI Mode : DIO␛[0m
15:17:52.887 > ␛[0;32mI (46) boot: SPI Flash Size : 4MB␛[0m
15:17:52.904 > ␛[0;32mI (50) boot: Partition Table:␛[0m
15:17:52.904 > ␛[0;32mI (53) boot: ## Label Usage Type ST Offset Length␛[0m
15:17:52.904 > ␛[0;32mI (60) boot: 0 nvs WiFi data 01 02 00009000 00006000␛[0m
15:17:52.919 > ␛[0;32mI (68) boot: 1 phy_init RF data 01 01 0000f000 00001000␛[0m
15:17:52.919 > ␛[0;32mI (75) boot: 2 factory factory app 00 00 00010000 00100000␛[0m
15:17:52.935 > ␛[0;32mI (83) boot: End of partition table␛[0m
15:17:52.935 > ␛[0;32mI (87) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x09928 ( 39208) map␛[0m
15:17:52.951 > ␛[0;32mI (110) esp_image: segment 1: paddr=0x00019950 vaddr=0x3ffb0000 size=0x02154 ( 8532) load␛[0m
15:17:52.951 > ␛[0;32mI (114) esp_image: segment 2: paddr=0x0001baac vaddr=0x40080000 size=0x00400 ( 1024) load␛[0m
15:17:52.967 > ␛[0;32mI (117) esp_image: segment 3: paddr=0x0001beb4 vaddr=0x40080400 size=0x0415c ( 16732) load␛[0m
15:17:52.967 > ␛[0;32mI (133) esp_image: segment 4: paddr=0x00020018 vaddr=0x400d0018 size=0x1c5a8 (116136) map␛[0m
15:17:52.983 > ␛[0;32mI (176) esp_image: segment 5: paddr=0x0003c5c8 vaddr=0x4008455c size=0x06148 ( 24904) load␛[0m
15:17:53.016 > ␛[0;32mI (193) boot: Loaded app from partition at offset 0x10000␛[0m
15:17:53.031 > ␛[0;32mI (194) boot: Disabling RNG early entropy source...␛[0m
15:17:53.047 > ␛[0;32mI (194) cpu_start: Pro cpu up.␛[0m
15:17:53.047 > ␛[0;32mI (198) cpu_start: Application information:␛[0m
15:17:53.047 > ␛[0;32mI (202) cpu_start: Project name: test_mmc_idf␛[0m
15:17:53.063 > ␛[0;32mI (208) cpu_start: App version: 1␛[0m
15:17:53.063 > ␛[0;32mI (212) cpu_start: Compile time: May 10 2020 12:19:59␛[0m
15:17:53.063 > ␛[0;32mI (218) cpu_start: ELF file SHA256: 3bafca7d9efc3e1b...␛[0m
15:17:53.079 > ␛[0;32mI (224) cpu_start: ESP-IDF: GIT-NOTFOUND␛[0m
15:17:53.079 > ␛[0;32mI (230) cpu_start: Starting app cpu, entry point is 0x40081384␛[0m
15:17:53.079 > ␛[0;32mI (0) cpu_start: App cpu up.␛[0m
15:17:53.095 > ␛[0;32mI (240) heap_init: Initializing. RAM available for dynamic allocation:␛[0m
15:17:53.095 > ␛[0;32mI (247) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM␛[0m
15:17:53.095 > ␛[0;32mI (253) heap_init: At 3FFB3250 len 0002CDB0 (179 KiB): DRAM␛[0m
15:17:53.112 > ␛[0;32mI (259) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM␛[0m
15:17:53.112 > ␛[0;32mI (266) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM␛[0m
15:17:53.127 > ␛[0;32mI (272) heap_init: At 4008A6A4 len 0001595C (86 KiB): IRAM␛[0m
15:17:53.127 > ␛[0;32mI (278) cpu_start: Pro cpu start user code␛[0m
15:17:53.127 > ␛[0;32mI (297) spi_flash: detected chip: gd␛[0m
15:17:53.143 > ␛[0;32mI (297) spi_flash: flash io: dio␛[0m
15:17:53.143 > ␛[0;32mI (297) cpu_start: Starting scheduler on PRO CPU.␛[0m
15:17:53.143 > ␛[0;32mI (0) cpu_start: Starting scheduler on APP CPU.␛[0m
15:17:53.160 > ␛[0;32mI (305) example: Initializing SD card␛[0m
15:17:53.160 > ␛[0;32mI (305) example: Using SDMMC peripheral␛[0m
15:17:53.160 > ␛[0;31mE (335) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107␛[0m
15:17:53.176 > ␛[0;31mE (335) example: Failed to initialize the card (ESP_ERR_TIMEOUT). Make sure SD card lines have pull-up resistors in place.␛[0m
i have loosed many days to find solution
i not know what else try or what can be, no ideas at the moment
someone can try to point me in the right direction?
thanks