What is the difference between USART and SPI ? There are [TXD/RXD] for USART and [MISO/MOSI/SCK/SS] for SPI. I know that SPI is a synchronous protocol but USART is hardware. But, what's difference between Synchronous part of USART and the hardware ?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
USART is a device (or peripheral). SPI is a standard method of connecting things.
USART stands for Universal Synchronous/Asynchronous Receiver/Transmitter, and is the basic thing you need if you want to transmit using RS-232.422/485/etc. The Synchronous part of a USART is not used very often, and is sometimes that functionality is left out of the device-- and then it's called a UART (pronounced You-Art).
USARTs (with an appropriate RS-232/etc driver/receiver) are mainly used to talk with devices over a cable. Sometimes they are used to talk between devices on the same PCB, or within the same box, but it is much more common to talk with another device over a cable.
SPI, the Serial Peripheral Interface Bus, is a completely different thing than a USART. SPI is mainly used to talk with devices on the same PCB or in the same box. For example, an MCU talking with a digital temperature sensor. It is almost never used to talk over a cable, from box to box.
The nice thing about SPI is that it is super simple, and the devices using SPI do not have to be MCUs. USARTs almost always require that MCUs of some sort are on both ends of the communication link. But USARTs can be connected using less wires over longer distances.
There is a major difference between USART and SPI; Synchronization
UART is Asynchronous - That means that the communication doesn't accompany a clock signal. Only data signals are connected along with sometimes optional flow control signals (RTS, CTS, DTR, DSR, etc.). UART can be full duplex or half duplex. RxD carries data from DCE to DTE. TxD carries data from DTE to DCE. UART is also point to point connection, there is one transmitter and one receiver on the whole link.
SPI is Synchronous - That means that the clock signal accompanies the data signal. MOSI - Master Out Slave In; MISO - Master In Slave Out; SCK - Clock signal from master to slave; SS - Slave Select signal selects salve devices. SPI is a bus and can have multiple devices on the bus. Because of a clock signal present, SPI can be operated faster than UART.
The Synchronous (U*S*ART) is hardly ever used. When it is, its actually quite similar to SPI. In fact, many microcontrollers call (one of) the synchronous mode(s), the SPI mode. Some examples are here and here.