Pins in SD Card example naming

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

Pins in SD Card example naming

Postby jumjum123 » Fri Feb 17, 2017 10:00 am

I would like to add SD card support to my application.
Good starting point should be the example.
RIght now I'm running into some confusion with naming.
On my SD Card interface I have MISO, MOSI, SCK and CS.
Tried to match with readme I would wire:
- SCK to GPIO14
- MISO to
- MOSI to
- CS to
One more question about GPIO12. This seems to be a special GPIO.
Is there a special reason to use it in your example ?
Already ran into a problem with that pin after adding an external pullup resistor.
With other words, is there a way to use other pins ?

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

Re: Pins in SD Card example naming

Postby ESP_igrr » Fri Feb 17, 2017 10:10 am

MISO, MOSI, SCK, and CS are SPI interface pins. I suppose that you are using a breakout board for an SD card designed to using the SD card in SPI mode. Current sdmmc driver in the ESP-IDF uses SD protocol to talk to the SD card, and doesn't support SPI protocol. The pins in the example are named according to the names of pins in SD protocol.

The pins of SDMMC peripheral in the ESP32 are not connected to the GPIO matrix, and can only be routed via IO MUX to these specific pins. SDMMC peripheral has two slots: a 4-bit one (HS2_* pins in esp32_chip_pin_list.pdf), the other is an 8-bit one (HS1_* pins).
This example uses the 4-bit slot. Please see the notes in the readme regarding GPIO12. I think they describe the limitations pretty well, and also give solutions for possible issues associated with this pin.

We also have a work-in-progress driver for SD cards in SPI mode. This driver can work with arbitrary pins because SPI peripheral signals can be routed via the GPIO matrix. The tradeoff is that the speed of SD card in SPI mode is slower than in SD mode. This driver will be available soon after the upcoming release (~in a couple of weeks).
Attachments
microsd pinout.jpg
microsd pinout.jpg (41.02 KiB) Viewed 5771 times
Screen Shot 2017-02-17 at 18.05.40.png
Screen Shot 2017-02-17 at 18.05.40.png (94.69 KiB) Viewed 5771 times

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

Re: Pins in SD Card example naming

Postby jumjum123 » Fri Feb 17, 2017 10:37 am

Wow, 10 minutes and response came in :o
I will wait for the SPI driver which will come (hopefully soon ;)

Who is online

Users browsing this forum: No registered users and 50 guests