Sharing SD-Card Pins between other SPI devices

e7p___
Posts: 1
Joined: Thu Apr 06, 2017 6:01 pm

Sharing SD-Card Pins between other SPI devices

Postby e7p___ » Thu Apr 06, 2017 6:16 pm

Hi,

I am pretty new to ESP32 development but I am currently working on a project which involves so many features that I in fact would need more GPIOs that the ESP-WROOM32 provides me with. But as I only need 3 more than it has, one solution for me would be, that I combine pins of an SD-Card slot with a SPI Bus (of course only MOSI, MISO and SCK pins) to share them between SD and SPI.

So my question is actually if this would be the best solution I could do to save me three GPIOs, and if it works how I just think. Thus it can be somehow split into multiple questions:
  • Is it generally possible to share pins between an SD-Card and other SPI devices, provided that I am able to turn off the supply voltage of the SD-Card seperately, and I have dedicated CS-Pins for the other SPI hardware.
  • Does it make sense at all, as it would involve heavily configuration switching between SD and SPI modes of the pins, and that takes at least some specific amount of time?
  • Is it instead supported by IDF to run the SD-Card in SPI mode, so should I rather connect the SD-card as an SPI-slave instead of the SD-dedicated pins?
  • if so, would this be more efficient as the SPI-Bus remains a SPI-Bus all the time?
When answering, note that in my case it won't probably be needed to access the SD-card very frequently, but instead the SPI devices have to be activated rather quick and have higher priority.

I hope we can find a solution, I really don't know if it would be best to connect the SD-card with the dedicated SD-Interface or via SPI, and if the decision has any major differences in writing the software later.

Best regards,
e7p

Who is online

Users browsing this forum: No registered users and 96 guests