I am examining a way to connect two microcontrollers. On the level of serialization I am thinking of using Nano protobuffers (http://code.google.com/p/nanopb/). This way I can encode/decode messages and send them between two processors.
Basically, one small processor would be the RPC server, capable of doing several functions. Bigger processor will call there RPCs via messages sent, and then when data is ready, it will read it from smaller processor.
What would be the pros/cons of using UART, I2C or SPI?
Messages will be put in the mailbox que prior to sending.
Best regards,Drasko
Drasko DRASKOVICDrasko DRASKOVIC
1 Answer
It depends on your total requirements and how expensive are pins.
I2C only needs two pins, but it's slow and to handle it with or without interrupts is a pain, even with the build in peripheral modules.It's a master/slave system, it's good for controlling many slow devices like temp sensors.
Only two lines for all bus devices, the selection is done via an I2C-Address in the protocol.
Only two lines for all bus devices, the selection is done via an I2C-Address in the protocol.
Uart needs two pins, it's normally faster, easier to handle, but requires (nearly) the same clocks at both sides.One to one asynchronous system, can be good if both systems needs to be send sometimes data without waiting for a master poll request.
Can also be used as a bus system, but then you need a master/slave structure or more complex protocols.
Can also be used as a bus system, but then you need a master/slave structure or more complex protocols.
SPI needs 3 (or 4 with CS) pins, it's the fastest, simple to implement even with DMA, low cpu time overhead, often buffered.When you have enough free pins I would prefer it.
jebI2c Vs Uart Performance Chart
jeb59.8k1313 gold badges137137 silver badges178178 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Not the answer you're looking for? Browse other questions tagged embeddedmicrocontrolleri2cuartspi or ask your own question.
SCLK: Serial Clock
MOSI: Master Output, Slave Input
MISO: Master Input, Slave Output
SS: Slave Select
Maximum data rate limit is not specified in SPI interface. Usually supports about 10 Mbps to 20 Mbps
highest
You up the difficulty, you increase faster in level. Horizon fallout 4 mod.
Synchronous
One
There is one common serial clock signal between master and slave devices.
less
Each company or manufacturers have got their own specific protocols to communicate with peripherals. Hence one needs to read datasheet to know read/write protocol for SPI communication to be established. For example we would like SPI communication between microcontroller and EPROM. Here one need to go through read/write operational diagram in the EPROM data sheet.
Slave select lines are used to address any particular slave connected with the master. There will be 'n' slave select lines on master device for 'n' slaves.
•It is simple protocol and hence so not require processing overheads.
•Supports full duplex communication.
Feb 25, 2010 I am trying to install the VFPODBC.MSI setup file on a windows 7 32 bit workstation. It appears to install correctly get no errors. However when i go in to Create a new System or User Odbc connection the VFP drivers are not listed and so i can't create a connection.
I2c Vs Uart Performance Software
•Due to separate use of CS lines, same kind of multiple chips can be used in the circuit design.
•SPI uses push-pull and hence higher data rates and longer ranges are possible.
•SPI uses less power compare to I2C
• As number of slave increases, number of CS lines increases, this results in hardware complexity as number of pins required will increase.
• To add a device in SPI requires one to add extra CS line and changes in software for particular device addressing is concerned.
•Master and slave relationship can not be changed as usually done in I2C interface.
•No flow control available in SPI.