I have two SPI slaves connected to one SPI bus on the raspberry. One uses SPI mode 1 the other uses SPI mode 3. In my C++ program I have two SPI_bus objects configured for each mode. If I now try to read each device individually everything works perfectly. But if I try to read both of them in one program I sometimes get communication errors where the communication is not successful (ioctl returns -1)

Could the devices somehow get confused even though they are disabled through chipSelects when writing to the other device in the other SPI mode?

  • That should work. As you say when a chip is not selected it will not affect the bus. Nothing to do with the Pi.
    – joan
    Apr 27, 2021 at 11:48
  • but it might confuse the device because of the clock polarity maybe? One is inactive high and one is inactive low clock.
    – FR_MPI
    Apr 27, 2021 at 12:58
  • But the chip is not selected!
    – joan
    Apr 27, 2021 at 13:44

1 Answer 1


So I found the problem.

Short answer is yes it is possible to have two modes on one bus if the spidev devices are different or are released after each SPI transaction cycle.

these two are one bus but 2 devices so can have 2 modes

these three are one bus but 3 devices so can have 3 modes

switching mode while the spi bus is initiated will not work if the devices do not know of each others existence. For example the idle low clock will stay high because the CPOL=1 device will hold it high.

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.