Track lengths for SD card data lines

czyskows
Posts: 8
Joined: Wed Nov 08, 2017 6:52 am

Track lengths for SD card data lines

Postby czyskows » Tue Nov 27, 2018 4:46 am

I'm having problems coming up with a working SD card design. I'm using the pins as the SD_MMC example:
DAT0 : IO2
DAT1 : IO4
DAT2 : IO12
DAT3 : IO13
CLK : IO14
CMD : IO15

And I have pull-up resistors in place for all the pins. But I can't get the SD card to mount with any of the example code in Arduino or ESP-IDF. The only problem I can think of is that the trace lengths are significantly different - differences of up to about 700 mils. Do the data and clock lines need to be similar lengths in order to work???

Any insight would be greatly appreciated!

p.s. - I tried using a slower max_freq in the host_config, but that didn't seem to have any effect.

pps - This is the error that I am getting:
rst:0x1 (POWERON_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:952
load:0x40078000,len:6084
load:0x40080000,len:7936
entry 0x40080310
E (1497) sdmmc_cmd: sdmmc_card_init: send_op_cond (1) returned 0x107
Card Mount Failed

0x107 https://www.esp32.com/viewtopic.php?t=2272#p10699 apparently means that the card did not respond to the CMD line, suggesting that D3 isn't pulled high - but it is.

macaba
Posts: 5
Joined: Thu Nov 08, 2018 1:42 pm

Re: Track lengths for SD card data lines

Postby macaba » Tue Nov 27, 2018 3:19 pm

I don't have an exact solution for you, but I though I'd post just in case it gives you an idea for a solution.

I've just brought up a custom PCB with exactly the same SD card IO that you're using. My trace length differences are up to 300 mil. I have a 22uF decoupling capacitor on the SD card 3.3V, and unpopulated pullups as many SD cards have internal pullups so I wanted to see how well it works. I will probably populate all the pullups except DAT0 later.

I used this example code exactly as-is to confirm functionality:
https://github.com/espressif/esp-idf/tr ... ge/sd_card

czyskows
Posts: 8
Joined: Wed Nov 08, 2017 6:52 am

Re: Track lengths for SD card data lines

Postby czyskows » Tue Nov 27, 2018 11:07 pm

Thank you for the reply, @macaba. I accidentally solved the problem. I had 0ohm resistors in place between between the SD card lines and the ESP32 pins, as that is how the layout for the dev kits are laid out. When I removed the resistor at DAT3 and placed a wire in its place, everything worked. I then removed all the 0ohm resistors and everything is still fine. I don't know why the dev kits have those resistors in place.

Who is online

Users browsing this forum: Accound, MicroController and 62 guests