I'm experimenting with using the raspberry pi as well as an FPGA, and I want to try making some program that runs on the pi but uses the FPGA for processing. When looking at the pi output pins I notice theres GPIO pins, but also some SPI, UART, I2C pin options as well. I don't really know what the differences are for these, other than they're all serial connections with master/slave interfaces. When you're designing a project, how do you decide what to use to communicate? I could use any of those things, or just send data in paralell through ALL the GPIOS, but I don't know what would be better/more efficient or how to figure it out.

closed as too broad by Jacobm001, dhruvvyas90, Bex, mpromonet, Steve Robillard Jul 27 '15 at 3:45

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


There are tradeoffs for each of the interfaces you mention:

  1. UART: setting up and reading/writing fron/to a UART port is fairly easy. However, UARTs typically cannot be driven at very high speeds and there could be issues with baud rate inaccuracies as well as insuring that the baud rate is the same on both sides.
  2. I2C: since the master drives the clock, there are no issues with clock synchronization on the slave side. And, in theory, i2c can be driven as high as 3.4MHz. However, i2c is a half duplex bux...you're either writing or reading to/from the slave. Also, there are electrical design considerations if high speed is needed.
  3. SPI: as with i2c, the master drives the clock, so there are no clock synchronization issues to speak of and, if implemented correctly, this is a full duplex bus and can be driven at very high speeds. However, there are more signals on this bus - Chip Select, Clock, Master In Slave Out (MISO) and Master Out Slave In (MOSI).
  4. GPIO: some people try to emulate a true parallel bus with this method, but personally, I would forget about this option because of the complexity.

It's not a simple answer, but for RPi, I'd go with SPI. It probably buys you the most simplicity and performance.

  • It might be worth pointing out that the I2C bus allows hundreds of devices to coexist whereas SPI is limited by the number of gpios assigned to slave select lines. SPI delivers faster speeds on the Pi, perhaps up to 30Mbps and has hardware support (as do UART and I2C). The gpio solution would have to be software driven. – joan Jul 20 '15 at 5:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.