1
\$\begingroup\$

So I am trying to add an SD card to my circuit and unfortunately, all I have left are 4 GPIOs, but I was asked to try and find a solution to only use 2. So using 4 is a worst case scenario. I thought about bit-banging SPI so that is one solution but ideally, I want to use 2 pins only so my guess is SPI is not possible and all is left is I2C bit-banging. I considered using an I2C-SPI bridge (speed is not a problem here), but memory is written in blocks of 512 bytes whereas the bridge sends 200 bytes at a time max.

Any solutions? If a 2-pin solution is not possible, what is the best solution using 4 pins?

\$\endgroup\$
5
  • \$\begingroup\$ How much space do you have available? \$\endgroup\$ Commented Mar 26, 2021 at 10:34
  • \$\begingroup\$ @BruceAbbott what do you mean by space? \$\endgroup\$
    – Nadir
    Commented Mar 26, 2021 at 10:34
  • \$\begingroup\$ I mean, what physical space do you have (on the PCB etc.) to add components. \$\endgroup\$ Commented Mar 26, 2021 at 10:43
  • \$\begingroup\$ @BruceAbbott I am not sure to be honest but that is not an issue here although the smaller the better of course \$\endgroup\$
    – Nadir
    Commented Mar 26, 2021 at 11:15
  • \$\begingroup\$ You can use that SCI18IS602B I2C-SPI bridge to send & receive 512-byte blocks. The trick would be to configure the SS pin to the SD card as a GPIO and control it 'manually' instead of letting the bridge IC control it automatically. \$\endgroup\$
    – brhans
    Commented Mar 26, 2021 at 15:18

1 Answer 1

0
\$\begingroup\$

Driving an SD CARD with 2 pins is not possible.

Driving an SD CARD with 3 pins might be doable in 1-bit mode:

Pin 1  ->  CMD
Pin 2  ->  CLK
Pin 3  ->  DAT_0

Take a look here for more detailed info in 1-bit mode:

https://www.keil.com/pack/doc/CMSIS/Driver/html/group__mci__interface__gr.html

As far as I know 2-bit mode doesn't exist.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.