Raspberry Pi SPI interface with PIC-16f877A

raspberry pispi

My project is to receive sensor data at I2C of PIC and transfer it to Raspberry Pi via SPI.

How can I interface my PIC and Raspberry Pi so that PIC starts receiving data as per command (SPI master—> Raspberry Pi, slave—> PIC)?

Need your suggestion to interface my 16F877A PIC with Raspberry Pi for mentioned case.

Best Answer

The Raspberry Pi currently only implements the master mode of SPI so it cannot function as a slave unless you wanted to create a software implementation of the SPI protocol. Another option would be to create a protocol where the Pi queries the PIC (as master) and get's data back. Per other comments though it is probably easier to implement the communication via serial.

Finally, the pins on the Pi are not 5V tolerant. The operating voltage of that PIC is 2-5.5v so just be careful if you're powering the PIC with anything above 3.3v.