Two SPI devices on one bus interfere: chip select pins

Each SPI device needs its own chip select (CS) pin, and every unused CS must be held high. Otherwise two devices answer at once.

What the message means

SPI shares the clock and data lines. The chip select tells one device to listen. A device whose CS is floating may react to traffic meant for another.

Fix it in this order

  1. Give each device its own CS pin and set it as an output.
  2. Set all CS pins HIGH in setup before you start any device.
  3. Join MOSI, MISO and SCK across all devices, and give each device power and ground.
  4. Initialise the devices one at a time and test each alone first.
  5. Check that the devices use compatible SPI modes and speeds, or set the settings before each transfer.
  6. Keep wires short, since long SPI wires cause errors at high speed.

Why it happens

SPI devices share three lines: clock, master-out and master-in. Each device also needs its own chip select line. The microcontroller pulls one chip select low to talk to a single device and keeps all others high. A device whose chip select floats, or is held low by mistake, listens to every transfer and can corrupt the data meant for another device.

Shared lines also make wiring quality and timing matter. Signals on long or poorly routed wires can ring or slow down, so one device may misread bits at a high clock speed. Each device may also expect a different SPI mode, meaning clock polarity and phase. Setting the chip select high before a transfer, and matching the mode for each device, prevents most mixed-device failures.

If you see this, do this

You seeDo this
Works alone, fails togetherCS pin floating or shared.
Random garbageSpeed too high or wires too long.

Confirm the fix

  1. Connect one device at a time and read its ID register. Each device should answer correctly alone before you add the next.
  2. Use a multimeter to confirm each chip select is high when idle and low only during its own transfer while a test sketch runs.
  3. Lower the SPI clock in the sketch, rerun the same transfer, and compare results. Clean data at a lower speed points to signal integrity.

Common mistake: Many readers assume that wiring each device’s MOSI, MISO and SCK in parallel is enough, when every device also needs its own chip select pin that is managed separately.

ESP32 default pins, SD card init failed.

Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.