SPI bus with different devices

If I have, say, an NFC card reader and an SD card device sharing the same SPI bus (with different CS pins) do the respective libraries work together. I.e does the second device to start recognise that the bus is active? Does it try to reset or redefine the bus parameters such as clock speed and cause the first device to fail?
Do I have to close my NFC readers, initialise the SD card. log the readings, close down the SD card and then initialise the readers again?
My ideal would be to have all devices active and only selected via their CS pins before I attempt to use each one.
I am attempting to design a single bus for use on an ESP8266 Lolin board which only has one effective SPI set of ports. ( I don't have enough ports left to define a second separate SPI bus)
The other SPI bus on that board is for internal flash use and not recommeded for general use.

I will be muxing the individual MISO ports when selecting the CS pin to prevent clashes and corruption and pulldown/up on that bus line.

Without know the libraries I cannot say for sure but if they were properly written it should work. The SPI devices only respond when selected. They can do other things but they do not access the bus. Only activate one CS\ at a time.

1 Like

Note that a number of cheap SD modules (as used for 5V Arduinos) do not release their MISO pin. That will result in failed reading from other devices.

If your board is a 5V board (e.g. Uno, Mega), it's best to buy a SD module from a decent supplier/manufacturer like Pololu or Adafruit and stay away from the cheap Chinese stuff.
If your board is a 3.3V board, just use a simple SD module that does not have additional electronics as ithat is not needed.

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.