EEVblog > News/Suggestions/Help

UART, SPI, & I2C

(1/3) > >>

Rhythmtech:
Serial communication protocols? An overview, what's the differences and why. When to use which and why.

Mechatrommer:
yup why? i'm still not fully understand why. all i know is that it has something to do with application suitability (volt level, bps limit, no of lines required or some hardware specific etc). or maybe everybody who created it just want to show their protocol is more superb than others. and i strongly believe the reason of this is similar to why of the changing from serial or parallel port to usb (protocol) port. because its better than other, but.... everybody just choose whatever suits them from all the option. even if usb is the new thing, some people will stick to serial port. IMO.

for more detail, u can check the wiki, i've saved all the protocol desc, but still havent compare them side by side. so far.. i've used uart and spi, from what i can see, the main difference (for my concern) is the max datarate, uart is limited up to 2Mbps, where spi can go up to 10-20Mbps. if a chip got both uart and spi, i'll prefer spi due to this reason, if... the other end can understand spi, otherwise, i'll just use uart, if any. if there is no serial comm port? then i'll use my own serial protocol ;D

Ferroto:

--- Quote from: Rhythmtech on June 24, 2010, 03:32:32 pm ---Serial communication protocols? An overview, what's the differences and why. When to use which and why.

--- End quote ---

I2C and SPI are generally only used to interface internal components in the same physical PCB

I2C uses a 7-bit address byte to address the slave device so you have a maximum of 127 combinations, however 16 of those are reserved so you get 111 possible devices. Some external devices that are not MCU's have specific pins to set the address of the slave device in hardware. This presents another problem, I have recently decided to hack an old printer because I wanted to find out what was on the EEPROM which was a microchip EEPROM. The EEPROM had 4 pins to set the lower 4 bits of the 7-bit device address, meaning the upper 3 bits were zeros. This only allows 15 devices with schemes such as this. Now this was not a problem as I was only trying to extract the data off the device.

UART has two data lines going in two directions allowing both devices to communicate without a designated slave device. The disadvantage is that this type of protocol only supports two devices.

RayJones:

--- Quote from: Ferroto on June 24, 2010, 04:19:58 pm ---UART has two data lines going in two directions allowing both devices to communicate without a designated slave device. The disadvantage is that this type of protocol only supports two devices.

--- End quote ---

Yes, but it can travel the world.

UART typically equals RS-232 asynchronous serial port.
The world used to be dominated by this form of serial data comms, and it still exists in many devices for low level access for reflashing etc.

SPI / I2C are internal busses within equipment and you can get cool devices that do a specific job.

SPI is the old traditional one, originally developed by Motorola at the time (now Freescale)

I2C was developed later by Philips to try to address some of the shortcoming like addressability that SPI has.

alm:
The disadvantage of UART is that's asynchronous, so the clock on both sides needs to be pretty close (2% or so) to work, which often requires an external crystal (as opposed to internal RC oscillator). The disadvantage of SPI is that you need an enable line per slave, and multi-master is hard to implement. I2C needs only two lines for lots of devices, but because it's an open collector interface with a pull-up resistor, the total capacitance is limited. SPI is the fastest and simplest (enable high and dump data).

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod