Is there any way to establish SPI communnication between Raspberry Pi 3B + and Arduino Due. Both only support master mode.
I tried to google but mostly answers from 2013 come up. Has there any recent progress?
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityIs there any way to establish SPI communnication between Raspberry Pi 3B + and Arduino Due. Both only support master mode.
I tried to google but mostly answers from 2013 come up. Has there any recent progress?
I do not know about the Arduino.
The Pi only supports being the SPI master. If you want to use the Pi as a SPI slave you will have to bit bang the interface in software. Of course this will only work for low bit rates as you need to ensure you can react to the clock in a timely fashion.
The Pi does have a peripheral which is documented to support a SPI slave mode. No one (including me) has managed to get it to work.
If you want to try to get the peripheral working in slave mode see BCM2835 ARM peripherals chapter 11 page 160 SPI/BSC slave.
Question
Can two SPI masters communicate?
Answer
I googled and found the following 2013 Microchip forum discussion conclusive. Therefore no newer discussions arise afterwards.
SPI between 2 Masters Discussion - MicroShip 2013jun05
I very much agree with the following points and conclusion:
This is a generic intrinsic limitation, not just related to Rpi or Arduino. Two masters cannot talk to each other, because the hardware design only supports the one master protocol. On the other hand, I2C is designed to be multi master (the pull down architecture enables and device to try to become a start by pulling down the data line, other devices addressed can respond, thus becoming a slave, ...) therefore two masters can talk to each other, with either one acts as master, the other slave.
To conclude, two SPI masters without any extra hardware signal lines cannot talk to each other.