I am having a tough time getting the sd card example or my own code working reliably.
The 2 dev boards I am using (DOIT ESP32 DevKit) I have
- used espefuse to set them for 3.3V flash so that GPIO 12 is not an issue for boot.
- jumpered GPIO 0 and GPIO 2 to ensure at boot GPIO 2 is low
- I have used 3 different SD Card board
- two are for micro cards and have 10k resistors on the board for the 6 data/cmd/clk lines
- the other is for full sized cards and does not have 10k resistors and in this case I added pull-ups to the 6 lines
- have used Master IDF, release 3.1.3, release 3.1.4, current release 3.2 branch
- I have used breadboard and also soldered up a prototype with short wires to try to minimize wire length and issues like that
- on breadboard my wires are 3" on one board and 6" on the other
I usually get 0x109 or 0x107 errors.
The weirdest part is that I have had it working and without changing the hardware side it just stops working and then doesn't ever seem to work again.
Last week board 1 and board 2 were wired the same but board 1 errored with 0x109 but board 2 worked fine. Switching the ESP32 board between configurations and the same configuration continued to work. Swapping the SD card the same config continued to work. Then I left the ESP32 on over night (just forgot to pull USB cable before went to bed). The next afternoon when I got back to it SD card access started to fail on the previously working config.
I am trying to build a data logging system for my track motorcycle. I was writing data to the SD Card fine then it just stopped. This same experience happened with config #1 several weeks back. I thought maybe I zapped it with static or something stupid (though didn't remember it). Though everything else still works (I2C, Serial).
The SD Card example and my code both error the exact same way.
So who has SD Card working and was there a trick to it?
Thanks, jeff
Who has had luck using SDIO 4-bit for SD Cards with IDF?
-
- Posts: 17
- Joined: Thu Mar 09, 2017 2:06 am
Re: Who has had luck using SDIO 4-bit for SD Cards with IDF?
Hi Jeff,
For me the main problem was getting the strapping and pull-up pins correct (see schematics)
I've got an implementation in both H/W and S/W that works with both in MMC and SPI mode. It's all open source and can be found at the links below. I've used KiCad to draw the schematics & PCB. I've really done nothing special software-wise as I rely on the functionality provided by IDF.
Hardware and application using SD Card: https://github.com/PerMalmberg/IO-Card-G3/
MMC implementation: https://github.com/PerMalmberg/Smooth/b ... SDCard.cpp
SPI implementation: https://github.com/PerMalmberg/Smooth/b ... SDCard.cpp
For me the main problem was getting the strapping and pull-up pins correct (see schematics)
I've got an implementation in both H/W and S/W that works with both in MMC and SPI mode. It's all open source and can be found at the links below. I've used KiCad to draw the schematics & PCB. I've really done nothing special software-wise as I rely on the functionality provided by IDF.
Hardware and application using SD Card: https://github.com/PerMalmberg/IO-Card-G3/
MMC implementation: https://github.com/PerMalmberg/Smooth/b ... SDCard.cpp
SPI implementation: https://github.com/PerMalmberg/Smooth/b ... SDCard.cpp
-
- Posts: 17
- Joined: Thu Mar 09, 2017 2:06 am
Re: Who has had luck using SDIO 4-bit for SD Cards with IDF?
Permal, thanks for the reply and pointing to your repo!
The first thing I notice is you use much weaker pull-up than I. You have 50K on your board and your software also enables the internal pull-up which from viewtopic.php?t=5111 we should consider is also 50K. So effectively you have a 25K pull-up resistor.
I have tried with both internal pull-up enabled and disabled. So with 10K pull-ups as per SD example readme I am 2.5 to 3 times stronger of a pull-up. How did you come to your values? Did you at one time have stronger pullup and have to adjust to get things to work?
I don't have TVS diodes to GND in my circuit either.
Otherwise things look rather similar. Will take a closer look when I get back home and can compare closer. Also plan on hooking up logic analyzer and looking at all the data lines from bootup to failure
Thanks, Jeff
The first thing I notice is you use much weaker pull-up than I. You have 50K on your board and your software also enables the internal pull-up which from viewtopic.php?t=5111 we should consider is also 50K. So effectively you have a 25K pull-up resistor.
I have tried with both internal pull-up enabled and disabled. So with 10K pull-ups as per SD example readme I am 2.5 to 3 times stronger of a pull-up. How did you come to your values? Did you at one time have stronger pullup and have to adjust to get things to work?
I don't have TVS diodes to GND in my circuit either.
Otherwise things look rather similar. Will take a closer look when I get back home and can compare closer. Also plan on hooking up logic analyzer and looking at all the data lines from bootup to failure
Thanks, Jeff
Re: Who has had luck using SDIO 4-bit for SD Cards with IDF?
Hm, the resulting 25K is actually a mistake on my side - I've forgotten I enable them in in software (except the one on GPIO12 which must be controlled via software due to the Wrover-B using 3.3V flash). Guess it works too...
I choose 50K after looking at the schematics for the Wrover-kit v3; Espressif have choosen 50k so I did the same.
I choose 50K after looking at the schematics for the Wrover-kit v3; Espressif have choosen 50k so I did the same.
Who is online
Users browsing this forum: No registered users and 120 guests