The first difference is of course the name:
SPI (Serial Peripheral Interface);
I2C (INTER IC BUS)
UART (Universal Asynchronous Receiver Transmitter)
Second, the difference is in the electrical signal lines:
The SPI bus consists of three signal lines: serial clock (SCLK), serial data output (SDO), and serial data input (SDI). The SPI bus can connect multiple SPI devices to each other. The SPI device that provides the SPI serial clock is the SPI host or master device (Master), and the other devices are SPI slaves or slave devices (Slave). Full-duplex communication can be achieved between the master and slave devices. When there are multiple slave devices, a slave device selection line can be added.
If a general IO port is used to simulate the SPI bus, there must be an output port (SDO), an input port (SDI), and the other port depends on the type of device to be implemented. If you want to implement a master-slave device, you need an input and output port. If you only implement a master device, you only need an output port. If you only implement a slave device, you only need an input port.
The I2C bus is a bidirectional, two-wire (SCL, SDA), serial, multi-master interface standard with a bus arbitration mechanism, which is very suitable for close-range, infrequent data communication between devices. In its protocol system, the device address of the destination device is always carried when transmitting data, so device networking can be realized.
If a general IO port is used to simulate the I2C bus and realize bidirectional transmission, an input and output port (SDA) is required, and an output port (SCL) is also required. (Note: I2C information is relatively little understood, and the description here may be incomplete)
The UART bus is an asynchronous serial port, so it is generally much more complicated than the previous two synchronous serial ports. It is generally composed of a baud rate generator (the baud rate generated is equal to 16 times the transmission baud rate), a UART receiver, and a UART transmitter. The hardware consists of two wires, one for sending and one for receiving.
Obviously, if a general IO port is used to simulate the UART bus, an input port and an output port are required.
Third, it is obvious from the second point that SPI and UART can achieve full-duplex, but I2C cannot;
Fourth, let's see what the experts have to say!
wudanyu: I2C has fewer lines, and I think it is more powerful than UART and SPI, but it is also more technically troublesome, because I2C needs to have bidirectional IO support, and uses pull-up resistors, I think the anti-interference ability is weak, and it is generally used for communication between chips on the same board, and is rarely used for long-distance communication. SPI is simpler to implement, UART requires a fixed baud rate, which means that the interval between two bits of data must be equal, while SPI does not matter because it is a clocked protocol.
quickmouse: I2C is a little slower than SPI, and the protocol is a little more complicated than SPI, but the connection is also less than the standard SPI.
SPI bus
----Serial peripheral interface SPI (serial peripheral interface) bus technology is a synchronous serial interface launched by Motorola. Most MCUs (microcontrollers) produced by Motorola are equipped with SPI hardware interfaces, such as the 68 series MCU. The SPI bus is a three-wire synchronous bus. Because of its powerful hardware functions, the software related to SPI is quite simple, giving the CPU more time to handle other matters. The
IIC bus is an efficient, practical and reliable two-wire (there is also a three-wire system, which is rarely used in home appliances) serial data transmission structure bus developed by Philips of the Netherlands. The bus divides each circuit into modules with various functions and performs software design. Each functional module circuit has an integrated IIC bus interface circuit, so it can be connected to the bus, which solves the input and output interface between many functional ICs and the CPU very well, making its connection method very simple.
The devices on the IIC bus are divided into two categories: master controller and slave controller. As long as they are working normally, there is always an IIC sending information data on the bus (generally, after the CPU is turned on, it first sends a self-test signal to each functional module circuit, and the machine enters a normal working state after receiving the normal feedback data signal from each functional module circuit).
Serial peripheral interface SPI (serial peripheral interface) bus technology is a synchronous serial interface introduced by Motorola.
USART (Universial Serial Asynchronous Receive Transmit) is actually UART.
Both are serial ports. But the difference is that the SPI bus seems to be divided into two types: SD (DATA) I and SC (CONTROL) I. SPI is synchronous and requires additional synchronization pulses. The rate can be very high, and some devices even exceed 20M. SDI has one data line, bidirectional transmission, and the direction is distinguished by the command word. SPI has three lines: SO, SI, SCK. SO and SI are both unidirectional transmission, among which SCK is the synchronous clock, and its transmission rate is variable and can be simulated by software; while SCI has two data lines, one for input and one for output. SPI has a clock line. However, if SPI is used in high-speed applications, it can only be used at the board level and should not be transmitted too far. The SPI and IIC we usually see are generally interfaces between chips, and long cables are rarely used.
USART has no clock line, but two data lines. The baud rate is set at both ends of the transmitter and receiver. 51 serial ports belong to this category. UART is asynchronous, does not require a clock, and has a relatively low baud rate. In view of this, UART can be transmitted on the transmission line because the format and baud rate are negotiated by both parties and the rate is not high. With other conversions, it can also be transformed into differential transmission for longer distances.
UART has certain requirements for the crystal oscillator to achieve a certain fixed baud rate. For example, a 24M crystal oscillator can use T2 to achieve 9600BAUD, but T1 cannot be used to alternately achieve 19200 and 9600BAUD.
Previous article:Technological Development of Digital Single Chip Microcomputer
Next article:The basic process of static mapping of IO space
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications