SPI IIC USART Difference

Publisher:太白山人Latest update time:2017-12-01 Source: eefocusKeywords:SPI  IIC  USART Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.


Keywords:SPI  IIC  USART Reference address:SPI IIC USART Difference

Previous article:Technological Development of Digital Single Chip Microcomputer
Next article:The basic process of static mapping of IO space

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号