Doit ESP32 DevKit v1 and SD Card Reader

photon
Posts: 7
Joined: Sat Jun 24, 2017 4:13 pm

Doit ESP32 DevKit v1 and SD Card Reader

Postby photon » Sat Jun 24, 2017 4:36 pm

Hello,
I am trying to connect a doit ESP32 DevKit v1 to an SD Card Reader. I am currently trying this one: https://m.banggood.com/3_3V5V-Micro-SD- ... 64192.html. What I did is I connected the module according to mapping in the ESP32 sd card example and used the example code. When I boot the ESP32 I get following error:

Code: Select all

rst:0x10 (RTCWDT_RTC_RESET),boot:0x37 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
Falling back to built-in command interpreter.
OK
The question is if this module can be used with my ESP32, and if no, which module should I used instead. Or, if I am doing something wrong instead.
Thanks a lot!

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: Doit ESP32 DevKit v1 and SD Card Reader

Postby ESP_Sprite » Sun Jun 25, 2017 3:47 am

Did you read the notes about GPIO12? Smells like that GPIO has the wrong signal level on bootup.

photon
Posts: 7
Joined: Sat Jun 24, 2017 4:13 pm

Re: Doit ESP32 DevKit v1 and SD Card Reader

Postby photon » Sun Jun 25, 2017 10:12 am

Hi,
on a second attempt I disconnected GPIO12 during startup and connected it back just before the sample routine is executed. Now my ESP32 starts, but it gives me another error:

Code: Select all

␛[0;32mI (23324) example: Initializing SD card␛[0m
␛[0;31mE (23344) sdmmc_cmd: sdmmc_card_init: send_scr returned 0x109␛[0m
␛[0;31mE (23344) example: Failed to initialize the card (265). Make sure SD card lines have pull-up resistors in place.␛[0m
I was under impression that the SD Reader I use has pull-up resistors in place already...?

photon
Posts: 7
Joined: Sat Jun 24, 2017 4:13 pm

Re: Doit ESP32 DevKit v1 and SD Card Reader

Postby photon » Sun Jun 25, 2017 12:17 pm

Out of curiosity I also tried the SDMMC_HOST_FLAG_1BIT and it did not work either. I suspect there is some problem with the reader itself, I'll try the arduino one instead and will post here if I had more luck there, even though this reader works in SPI mode only. Thank you for your answer!

photon
Posts: 7
Joined: Sat Jun 24, 2017 4:13 pm

Re: Doit ESP32 DevKit v1 and SD Card Reader

Postby photon » Sun Jun 25, 2017 9:48 pm

Now I am lost completely. I measured the current levels on the sd card reader, the resistivity of resistors on the board, I even tried my own 10k resistors as pull-ups but nothing helped :( Where should I start looking, before the other reader arrives? I tried 3 different sd-cards also. Should I try to solder wires onto the sd directly and use 10k pull-ups for CMD, CLK and D0?

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Doit ESP32 DevKit v1 and SD Card Reader

Postby ESP_igrr » Mon Jun 26, 2017 5:39 am

For the case when you choose SDMMC_HOST_FLAG_1BIT, please try setting log level to "Verbose" in menuconfig -> component config -> log output, and then attach the log here.

photon
Posts: 7
Joined: Sat Jun 24, 2017 4:13 pm

Re: Doit ESP32 DevKit v1 and SD Card Reader

Postby photon » Mon Jun 26, 2017 8:29 pm

Thank you for the response. I used
host.flags = SDMMC_HOST_FLAG_1BIT;
Output is following:

Code: Select all

␛[0;32mI (609) example: Initializing SD card␛[0m
D (609) sdmmc_periph: peripheral version 5342270a, hardware config 03c44c83␛[0m
V (609) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args␛[0m
V (619) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE␛[0m
D (619) intr_alloc: Connected src 37 to int 13 (cpu 0)␛[0m
D (629) sdmmc_periph: slot=1 div=50 freq=400kHz␛[0m
D (629) sdmmc_periph: slot=1 width=1␛[0m
D (639) sdmmc_cmd: sdmmc_card_init␛[0m
V (639) sdmmc_cmd: sending cmd slot=1 op=0 arg=0 flags=20 data=0x0 blklen=0 datalen=0␛[0m
V (649) sdmmc_req: make_hw_cmd: opcode=0, rexp=0, crc=0␛[0m
V (649) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000␛[0m
V (659) sdmmc_req: process_events: state=SENDING_CMD␛[0m
V (659) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE␛[0m
V (669) sdmmc_req: process_events state=IDLE next_state=IDLE␛[0m
V (679) sdmmc_cmd: cmd response 00000000 00000000 00000000 00000000 err=0x0 state=0␛[0m
V (689) sdmmc_cmd: sending cmd slot=1 op=8 arg=1aa flags=1c30 data=0x0 blklen=0 datalen=0␛[0m
V (689) sdmmc_req: make_hw_cmd: opcode=8, rexp=1, crc=1␛[0m
V (699) sdmmc_req: sdmmc_handle_event: evt 00000100 00000000␛[0m
V (699) sdmmc_req: process_events: state=SENDING_CMD␛[0m
D (709) sdmmc_req: process_command_response: error 263␛[0m
V (709) sdmmc_req: process_events state=SENDING_CMD next_state=SENDING_CMD␛[0m
V (719) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000␛[0m
V (729) sdmmc_req: process_events: state=SENDING_CMD␛[0m
D (729) sdmmc_req: process_command_response: error 263␛[0m
V (739) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE␛[0m
V (739) sdmmc_req: process_events state=IDLE next_state=IDLE␛[0m
V (749) sdmmc_cmd: cmd response 00000000 00000000 00000000 00000000 err=0x107 state=0␛[0m
D (759) sdmmc_cmd: CMD8 timeout; not an SDHC/SDXC card␛[0m
V (759) sdmmc_cmd: sending cmd slot=1 op=55 arg=0 flags=1c00 data=0x0 blklen=0 datalen=0␛[0m
V (769) sdmmc_req: make_hw_cmd: opcode=55, rexp=1, crc=1␛[0m
V (779) sdmmc_req: sdmmc_handle_event: evt 00000100 00000000␛[0m
V (779) sdmmc_req: process_events: state=SENDING_CMD␛[0m
D (789) sdmmc_req: process_command_response: error 263␛[0m
V (789) sdmmc_req: process_events state=SENDING_CMD next_state=SENDING_CMD␛[0m
V (799) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000␛[0m
V (799) sdmmc_req: process_events: state=SENDING_CMD␛[0m
D (809) sdmmc_req: process_command_response: error 263␛[0m
V (809) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE␛[0m
V (819) sdmmc_req: process_events state=IDLE next_state=IDLE␛[0m
V (829) sdmmc_cmd: cmd response 00000000 00000000 00000000 00000000 err=0x107 state=0␛[0m
␛[0;31mE (829) sdmmc_cmd: sdmmc_card_init: send_op_cond (1) returned 0x107␛[0m
D (839) vfs_fat_sdmmc: sdmmc_card_init failed 0x(107)␛[0m
V (849) intr_alloc: esp_intr_free: Disabling int, killing handler␛[0m
␛[0;31mE (849) example: Failed to initialize the card (263). Make sure SD card lines have pull-up resistors in place.␛[0m
This was for 2GB microSD. After that I removed the card completely, and got the same output :) Therefore, out of curiosity, I tried a different card (Samsung EVO Plus Micro SDXC USH-1 U3 128GB Class10 ), and got completely different output:

Code: Select all

›[0;32mI (609) example: Initializing SD card
D (609) sdmmc_periph: peripheral version 5342270a, hardware config 03c44c83
V (609) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (619) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
D (619) intr_alloc: Connected src 37 to int 13 (cpu 0)
D (629) sdmmc_periph: slot=1 div=50 freq=400kHz
D (629) sdmmc_periph: slot=1 width=1
D (639) sdmmc_cmd: sdmmc_card_init
V (639) sdmmc_cmd: sending cmd slot=1 op=0 arg=0 flags=20 data=0x0 blklen=0 datalen=0
V (649) sdmmc_req: make_hw_cmd: opcode=0, rexp=0, crc=0
V (649) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000
V (659) sdmmc_req: process_events: state=SENDING_CMD
V (659) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE
V (669) sdmmc_req: process_events state=IDLE next_state=IDLE
V (679) sdmmc_cmd: cmd response 00000000 00000000 00000000 00000000 err=0x0 state=0
V (689) sdmmc_cmd: sending cmd slot=1 op=8 arg=1aa flags=1c30 data=0x0 blklen=0 datalen=0
V (689) sdmmc_req: make_hw_cmd: opcode=8, rexp=1, crc=1
V (699) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000
V (699) sdmmc_req: process_events: state=SENDING_CMD
V (709) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE
V (719) sdmmc_req: process_events state=IDLE next_state=IDLE
V (719) sdmmc_cmd: cmd response 000001aa 00000000 00000000 00000000 err=0x0 state=0
D (729) sdmmc_cmd: SDHC/SDXC card
V (729) sdmmc_cmd: sending cmd slot=1 op=55 arg=0 flags=1c00 data=0x0 blklen=0 datalen=0
V (739) sdmmc_req: make_hw_cmd: opcode=55, rexp=1, crc=1
V (749) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000
V (749) sdmmc_req: process_events: state=SENDING_CMD
V (759) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE
V (759) sdmmc_req: process_events state=IDLE next_state=IDLE
V (769) sdmmc_cmd: cmd response 00000120 00000000 00000000 00000000 err=0x0 state=0
V (779) sdmmc_cmd: sending cmd slot=1 op=41 arg=40ff8000 flags=1030 data=0x0 blklen=0 datalen=0
V (779) sdmmc_req: make_hw_cmd: opcode=41, rexp=1, crc=0
V (789) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000
V (799) sdmmc_req: process_events: state=SENDING_CMD
V (799) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE
V (809) sdmmc_req: process_events state=IDLE next_state=IDLE
V (809) sdmmc_cmd: cmd response 40ff8000 00000000 00000000 00000000 err=0x0 state=0
V (829) sdmmc_cmd: sending cmd slot=1 op=55 arg=0 flags=1c00 data=0x0 blklen=0 datalen=0
V (829) sdmmc_req: make_hw_cmd: opcode=55, rexp=1, crc=1
V (829) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000
V (839) sdmmc_req: process_events: state=SENDING_CMD
V (839) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE
V (849) sdmmc_req: process_events state=IDLE next_state=IDLE
V (859) sdmmc_cmd: cmd response 00000120 00000000 00000000 00000000 err=0x0 state=0
V (859) sdmmc_cmd: sending cmd slot=1 op=41 arg=40ff8000 flags=1030 data=0x0 blklen=0 datalen=0
V (869) sdmmc_req: make_hw_cmd: opcode=41, rexp=1, crc=0
V (879) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000
V (879) sdmmc_req: process_events: state=SENDING_CMD
V (889) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE
V (899) sdmmc_req: process_events state=IDLE next_state=IDLE
V (899) sdmmc_cmd: cmd response c0ff8000 00000000 00000000 00000000 err=0x0 state=0
D (909) sdmmc_cmd: sdmmc_card_init: host_ocr=40ff8000, card_ocr=c0ff8000
V (919) sdmmc_cmd: sending cmd slot=1 op=2 arg=0 flags=1630 data=0x0 blklen=0 datalen=0
V (919) sdmmc_req: make_hw_cmd: opcode=2, rexp=1, crc=1
V (929) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000
V (939) sdmmc_req: process_events: state=SENDING_CMD
V (939) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE
V (949) sdmmc_req: process_events state=IDLE next_state=IDLE
V (949) sdmmc_cmd: cmd response 1b534d45 44345154 30600f5f 3e011419 err=0x0 state=6
V (959) sdmmc_cmd: sending cmd slot=1 op=3 arg=0 flags=1c30 data=0x0 blklen=0 datalen=0
V (969) sdmmc_req: make_hw_cmd: opcode=3, rexp=1, crc=1
V (969) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000
V (979) sdmmc_req: process_events: state=SENDING_CMD
V (979) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE
V (989) sdmmc_req: process_events state=IDLE next_state=IDLE
V (999) sdmmc_cmd: cmd response 00010520 00000000 00000000 00000000 err=0x0 state=2
V (999) sdmmc_cmd: sending cmd slot=1 op=9 arg=10000 flags=1600 data=0x0 blklen=0 datalen=0
V (1009) sdmmc_req: make_hw_cmd: opcode=9, rexp=1, crc=1
V (1019) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000
V (1019) sdmmc_req: process_events: state=SENDING_CMD
V (1029) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE
V (1039) sdmmc_req: process_events state=IDLE next_state=IDLE
V (1039) sdmmc_cmd: cmd response 400e0032 5b590003 b9ff7f80 0a4040ab err=0x0 state=0
V (1049) sdmmc_cmd: sending cmd slot=1 op=7 arg=10000 flags=1c00 data=0x0 blklen=0 datalen=0
V (1059) sdmmc_req: make_hw_cmd: opcode=7, rexp=1, crc=1
V (1059) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000
V (1069) sdmmc_req: process_events: state=SENDING_CMD
V (1069) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE
V (1079) sdmmc_req: process_events state=IDLE next_state=IDLE
V (1089) sdmmc_cmd: cmd response 00000700 00000000 00000000 00000000 err=0x0 state=3
V (1089) sdmmc_cmd: sending cmd slot=1 op=55 arg=10000 flags=1c00 data=0x0 blklen=0 datalen=0
V (1099) sdmmc_req: make_hw_cmd: opcode=55, rexp=1, crc=1
V (1109) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000
V (1109) sdmmc_req: process_events: state=SENDING_CMD
V (1119) sdmmc_req: process_events state=SENDING_CMD next_state=IDLE
V (1129) sdmmc_req: process_events state=IDLE next_state=IDLE
V (1129) sdmmc_cmd: cmd response 00000920 00000000 00000000 00000000 err=0x0 state=4
V (1139) sdmmc_cmd: sending cmd slot=1 op=51 arg=0 flags=1c50 data=0x3ffcbff0 blklen=8 datalen=8
V (1149) sdmmc_req: make_hw_cmd: opcode=51, rexp=1, crc=1
V (1149) sdmmc_req: fill 4 desc=0 rem=0 next=1 last=1 sz=8
V (1159) sdmmc_req: sdmmc_handle_event: evt 00000004 00000000
V (1159) sdmmc_req: process_events: state=SENDING_CMD
V (1169) sdmmc_req: process_events state=SENDING_CMD next_state=SENDIND_DATA
V (1179) sdmmc_req: process_events state=SENDIND_DATA next_state=SENDIND_DATA
V (1179) sdmmc_req: sdmmc_handle_event: evt 00008080 00000000
V (1189) sdmmc_req: process_events: state=SENDIND_DATA
D (1189) sdmmc_req: process_data_status: error 265
V (1199) sdmmc_req: process_events state=SENDIND_DATA next_state=SENDIND_DATA
V (1209) sdmmc_req: sdmmc_handle_event: evt 00000008 00000002
V (1209) sdmmc_req: process_events: state=SENDIND_DATA
V (1219) sdmmc_req: process_events state=SENDIND_DATA next_state=BUSY
D (1219) sdmmc_req: process_data_status: error 265
V (1229) sdmmc_req: process_events state=BUSY next_state=IDLE
V (1239) sdmmc_req: process_events state=IDLE next_state=IDLE
V (1239) sdmmc_cmd: cmd response 00000920 00000000 00000000 00000000 err=0x109 state=4
›[0;31mE (1249) sdmmc_cmd: sdmmc_card_init: send_scr returned 0x109
D (1259) vfs_fat_sdmmc: sdmmc_card_init failed 0x(109)
V (1259) intr_alloc: esp_intr_free: Disabling int, killing handler
›[0;31mE (1269) example: Failed to initialize the card (265). Make sure SD card lines have pull-up resistors in place.

photon
Posts: 7
Joined: Sat Jun 24, 2017 4:13 pm

Re: Doit ESP32 DevKit v1 and SD Card Reader

Postby photon » Thu Jun 29, 2017 7:13 am

Do you have any idea what could be the cause? I do not know if this is a HW issue, or something I should change in the program...?

photon
Posts: 7
Joined: Sat Jun 24, 2017 4:13 pm

Re: Doit ESP32 DevKit v1 and SD Card Reader

Postby photon » Sun Jul 02, 2017 12:36 pm

Tried more ordinary Samsung 32GB MicroSDHC and got exactly the same output as for 128GB. This most likely a problem with either the reader or wiring, otherwise I cannot explain it.

Who is online

Users browsing this forum: akasaka_spk and 88 guests