SDMMC - different SPI Pins

mseerig
Posts: 8
Joined: Tue Feb 21, 2017 2:10 pm

SDMMC - different SPI Pins

Postby mseerig » Tue Apr 11, 2017 11:28 am

Hey,
since a few hours, I'm looking through the esp-idf for a chance to change the native SPI Pins. ( GPIO4 -> GPIO13 / GPIO2 -> GPIO12 )
Normally, it should be possible to declare own SPI Pins like in the SPI master example.
For example: "components/driver/sdmmc_host.c" ... There are nothing written with 2-line mode, or SPI-Mode..

My fundamental Question: Where are the "GPIO_MUX" for the SDMMC SPI-Mode?

Thanks in advance!

Marcel

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

Re: SDMMC - different SPI Pins

Postby ESP_igrr » Tue Apr 11, 2017 3:33 pm

sdmmc_host is the driver for the SDMMC peripheral. It doesn't support SPI mode, and works only in SD/MMC mode.
It supports two slots. You can find pin definitions for these slots on the last page of ESP32 datasheet, look for HS1 and HS2 signal groups. HS1 is an 8-bit-wide slot which overlaps with default pins used to connect SPI flash chip. This slot is only usable if your design has the SPI flash connected to different pins than default. The other slot, HS2, is the only slot which can be used for the "normal" modules (the ones with flash chip on default pins).

We have the driver for SD cards in SPI mode in development, this driver uses SPI peripheral instead. SPI peripheral signals can be routed via GPIO matrix to almost arbitrary pads, so this driver will be more flexible (but performance in SPI mode will be lower than in SD mode).

mseerig
Posts: 8
Joined: Tue Feb 21, 2017 2:10 pm

Re: SDMMC - different SPI Pins

Postby mseerig » Tue Apr 18, 2017 7:05 am

We have the driver for SD cards in SPI mode in development, this driver uses SPI peripheral instead.
That's are good news! ;)
Ironically, I got a running SD Card with the properties:

Code: Select all

.flags = SDMMC_HOST_FLAG_SPI

Is this currently not running under SPI? ..it seamed that it is a SPI.. :shock:

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

Re: SDMMC - different SPI Pins

Postby ESP_igrr » Tue Apr 18, 2017 8:24 am

SDMMC_HOST_FLAG_SPI is defined for future use, but currently the SDMMC protocol layer doesn't check for this flag. The only thing it currently checks for is flags & SDMMC_HOST_FLAG_4BIT, i.e. whether you want to use 4-bit wide SD interface or not. So setting this flag has no effect for now.

Once SPI support is added, upper layer will check this flag when deciding which protocol to use to talk to the card — SD or SPI.

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: SDMMC - different SPI Pins

Postby loboris » Tue Apr 18, 2017 10:37 am

mseerig wrote:...
Is this currently not running under SPI? ..it seamed that it is a SPI.. :shock:
When .flags = SDMMC_HOST_FLAG_SPI is set, the driver uses default 1-line SD and MMC protocol.
The only reason why SPI mode could be useful, as I see it, is the possibility to to attach sd card to different than default GPIOs.
As we have to spend 4 pins for sd card anyhow, I dont see much reason to implement the SPI mode at all.

Who is online

Users browsing this forum: No registered users and 267 guests