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.

  • 1
    \$\begingroup\$ Why not use plain async TTL serial (RS232 signaling)? Not sure if the RPI UART can handle 5V, you might need a level converter for that, since it's at 3.3V. Both the PIC and RPI have dedicated UART's for serial data, this is much easier than using SPI. In the case you need the UART on the RPI for other uses, get a USB hub and a USB <--> UART converter (they are cheap). You would then get a /dev/ttyUSB0 device on your RPI, and wouldn't need a level converter since USB is 5V. \$\endgroup\$ May 24, 2014 at 10:21
  • \$\begingroup\$ Pål Thingbø I think the main reason not to choose a UART would be the throughput. UART can reasonably do 115kbps while SPI can do 20MHz or more. \$\endgroup\$
    – Alexxx
    Dec 24, 2014 at 17:11

1 Answer 1


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.


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.