Micro-controllers are useful to the extent that they communicate with other devices, such as sensors, motors, switches, keypads, displays, memory and even other micro-controllers. Many interface methods have been developed over the years to solve the complex problem of balancing circuit design criteria such as features, cost, size, weight, power consumption, reliability, availability, manufacturability.
Many microcontroller designs typically mix multiple interfacing methods. In a very simplistic form, a micro-controller system can be viewed as a system that reads from (monitors) inputs, performs processing and writes to ( controls ) outputs.
I2C ( Inter Integrated Circuit bus )
2-wire interface with one master and multiple slaves ( multi-master configurations possible ).
Originated by Philips Semiconductor in the early 80’s to connect a microcontroller to peripheral devices in TV sets.
Signals: DATA (SDA), CLOCK (SCL) and Ground. SDA is always bi-directional; SCL is bidirectional only in multi-master mode.
Maximum allowable capacitance on the lines is 400 pF. Typical device capacitance is 10 pF. To start the communications, the bus master (typically a microcontroller) places the address of the device with which it intends to communicate (the slave) on the bus. All slave devices monitor the bus to determine if the master device is sending their address.
Only the device with the correct address communicates with the master.
By definition, I2C is 5V.
SPI ( Serial Peripheral Interface )
4-wire interface with one master and multiple slaves. Signals: DATA IN, DATA OUT, CLOCK, CS
( Chip Select )
Originated by Motorola, SPI bus is a relatively simple synchronous serial interface for connecting low speed external devices using minimal number of wires. A synchronous clock shifts serial data into and out of the microcontrollers in blocks of 8 bits.
SPI bus is a master/slave interface. Whenever two devices communicate, one is referred to as the "master" and the other as the "slave" device. The master drives the serial clock. SPI is full duplex: Data is simultaneously transmitted and received.