Issues with interfacing MicroSD using SPI/1-line

krajem
Posts: 3
Joined: Mon May 29, 2017 1:46 pm

Issues with interfacing MicroSD using SPI/1-line

Postby krajem » Mon May 29, 2017 2:01 pm

Yet another SDIO topic... I'm trying to run microSD card with sd_card_example_main. Have tried both: SPI and Bit1 modes, but lets start with SPI to keep things simple.

So, what I got:

1) Shield Module SPI Micro SD Adapter For Arduino, successfully tested with Arduino Nano with SPI.

2) Wiring:
GPIO15 (MTDO) | CS
GPIO14 (MTMS) | SCK
GPIO13 (MTCK) | MOSI
GPIO12 (MTDI) | MISO
5V | VCC

3) The only changes to the example code:
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
host.flags = SDMMC_HOST_FLAG_SPI;

4) Logs:

I (45) boot: ESP-IDF v2.0-rc1-845-ga38cecef-dirty 2nd stage bootloader
I (45) boot: compile time 15:45:09
I (48) boot: Enabling RNG early entropy source...
I (65) boot: SPI Speed : 40MHz
I (78) boot: SPI Mode : DIO
I (90) boot: SPI Flash Size : 4MB
I (102) boot: Partition Table:
I (114) boot: ## Label Usage Type ST Offset Length
I (136) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (160) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (183) boot: 2 factory factory app 00 00 00010000 00100000
I (206) boot: End of partition table
I (219) boot: Disabling RNG early entropy source...
I (236) boot: Loading app partition at offset 00010000
I (785) boot: segment 0: paddr=0x00010018 vaddr=0x00000000 size=0x0ffe8 ( 65512)
I (785) boot: segment 1: paddr=0x00020008 vaddr=0x3f400010 size=0x08e44 ( 36420) map
I (801) boot: segment 2: paddr=0x00028e54 vaddr=0x3ffb0000 size=0x02b04 ( 11012) load
I (832) boot: segment 3: paddr=0x0002b960 vaddr=0x40080000 size=0x00400 ( 1024) load
I (854) boot: segment 4: paddr=0x0002bd68 vaddr=0x40080400 size=0x12e34 ( 77364) load
I (917) boot: segment 5: paddr=0x0003eba4 vaddr=0x400c0000 size=0x00000 ( 0) load
I (918) boot: segment 6: paddr=0x0003ebac vaddr=0x00000000 size=0x0145c ( 5212)
I (938) boot: segment 7: paddr=0x00040010 vaddr=0x400d0018 size=0x2c938 (182584) map
I (964) cpu_start: Pro cpu up.
I (975) cpu_start: Starting app cpu, entry point is 0x40080e30
I (0) cpu_start: App cpu up.
I (1008) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (1030) heap_alloc_caps: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM
I (1051) heap_alloc_caps: At 3FFB64B0 len 00029B50 (166 KiB): DRAM
I (1072) heap_alloc_caps: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (1093) heap_alloc_caps: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1115) heap_alloc_caps: At 40093234 len 0000CDCC (51 KiB): IRAM
I (1136) cpu_start: Pro cpu start user code
I (1193) cpu_start: Starting scheduler on PRO CPU.
I (1195) cpu_start: Starting scheduler on APP CPU.
I (1195) example: Initializing SD
E (6205) sdmmc_req: handle_idle_state_events unhandled: 00000004 00000000
E (6205) sdmmc_cmd: sdmmc_card_init: send_op_cond (1) returned 0x107
E (6205) example: Failed to initialize the card (263). Make sure SD card lines have pull-up resistors in place.


Can you spot any obvious problems with this setup? Which pull-up resistors are needed in the SPI mode? Any further code changes required in the SPI mode?

Thanks in advance!

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

Re: Issues with interfacing MicroSD using SPI/1-line

Postby ESP_igrr » Mon May 29, 2017 10:36 pm

The documentation mentions that SDMMC driver doesn't support SPI mode. The flag for SPI mode is reserved for future expansion.

krajem
Posts: 3
Joined: Mon May 29, 2017 1:46 pm

Re: Issues with interfacing MicroSD using SPI/1-line

Postby krajem » Tue May 30, 2017 9:21 am

I'm getting the same error when trying 1-line setup. But again this might be problem of the adapter itself. I'll get myself a "naked" SD breakout board and try again. Thanks!

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

Re: Issues with interfacing MicroSD using SPI/1-line

Postby ESP_igrr » Tue May 30, 2017 10:38 am

Note that your wiring should be as described in the example readme, and there should be a pullup resistor on the card's D3 line, even if you are using it in a single lane mode.

krajem
Posts: 3
Joined: Mon May 29, 2017 1:46 pm

Re: Issues with interfacing MicroSD using SPI/1-line

Postby krajem » Tue May 30, 2017 8:51 pm

Just to be sure, here is the wiring I'm using.
Attachments
1line.png
1line.png (93.35 KiB) Viewed 7576 times

Who is online

Users browsing this forum: No registered users and 132 guests