ss_gpio should be optional
Closed this issue · 3 comments
It's very useful for projects that are using a single SPI sdcard and the CS is hardwired, this way we save a pin ;-) .
Do you have any evidence that off the shelf SD cards can work with CS hardwired?
Physical Layer Specification Version 3.01 says:
Every command or data block is built of 8-bit bytes and is byte aligned to the CS signal (i.e. the length is a multiple of 8 clock cycles). The card starts to count SPI bus clock cycle at the assertion of the CS signal. Every command or data token shall be aligned to 8-clock cycle boundary... The host starts every bus transaction by asserting the CS signal low.
I think I have encountered SD cards that insist on having CS raised between transactions. That's not to say that there are not SD cards that will work with CS tied low; I just don't know.
Ah, you're right
If you want to save pins, I think a better approach is to use 1-bit SDIO.
- SCLK; clock
- MOSI (or COPI, or "peripheral's Data Input [DI]")
- MISO (or CIPO, or "peripheral's Data Output [DO]")
- SS (or CS); select
For 1-bit SDIO you need:
- CLK; clock
- CMD; command
- DAT0; data (bidirectional)
There is an implementation in pico_sd_card. I am considering adding that functionality to this library.