I am short on pins and have a few SPI items to control. The MOSI, MISO and clock are accounted for but I need a few CS wires. I had planned on using the SD.h library which requires a pin for SD.begin. While I may be short on Arduino pins I have a SIPO chain available which I can add as many pins as needed.
Since the CS pin I would think is not very sensitive to speed I would like to use the SIPO chain to control the CS pins. The main issue I am concerned about it using the SD.begin(PIN_SPI_CS) command.
Looking at SD.h it looks to include SdFat.h but I can't seem to locate where the CS is called.
Will I need to use another library other than SD.h or is there a method that I can use to disable the calls for the writes to the CS pins and control them with the main code?
My apologies in advance if I have omitted any key bits that would be helpful/necessary but I haven't drafted the code because I am aware of the issue early.
Thanks.
I have not, but it certainly sounds like a good idea.
I see in that file SD_CHIP_SELECT_MODE I will need to dig some more to see how it is all structured.
Once I have solved the CS pin issue, I will breadboard test the intended SPI community. I would assume that if needed I could add a buffer on the MISO wire.
Having looked into the SD.h reference and a number of the sub headers, I have come to the conclusion that it would be more trouble to try to use the CS via a shift register than it would be to free up a pin using other methods. Further the reference clearly states
" Note that even if you use a different chip select pin, the hardware SS pin must be kept as an output or the SD library functions will not work .
On can leave SD.begin blank but it will assume you are using the default pin as CS.
I am happy to be aware now that TF cards might not really go high impedance when not selected. I will prepare accordingly by adding a buffer.