What is the UART communication protocol?
As an asynchronous serial communication protocol, UART works by transmitting each character of the transmitted data one by one. The meaning of each bit is as follows:
Start bit: First send a logic "0" signal to indicate the start of character transmission.
Data bit: Immediately after the start bit. The number of data bits can be 4, 5, 6, 7, 8, etc., to form a character. Usually ASCII code is used. Transmission starts from the lowest bit and is positioned by the clock.
Parity bit: After adding this bit to the data bit, the number of "1" bits should be an even number (even parity) or an odd number (odd parity) to verify the correctness of data transmission.
Stop bit: It is a sign of the end of a character data. It can be 1 bit, 1.5 bit, or 2 bit high level. Because the data is timed on the transmission line, and each device has its own clock, it is very likely that there will be a small desynchronization between the two devices during communication. Therefore, the stop bit not only indicates the end of the transmission, but also provides the computer with an opportunity to correct the clock synchronization. The more bits applicable to the stop bit, the greater the tolerance for different clock synchronization, but the slower the data transmission rate.
Idle bit: in the logic "1" state, indicating that there is no data transmission on the current line.
Working principle of UART serial communication
(1) Data transmission process
Idle state, the line is at a high level; when receiving the send command, the line is pulled down for a data bit time T, and then the data is sent in sequence from low to high. After the data is sent, the parity bit and stop bit are sent, and a frame of data is sent.
(2) Data reception process:
Idle state, the line is at a high level; when the falling edge of the line is detected (high level changes to low level), it means that the line has data transmission. According to the agreed baud rate, the data is received from low to high. After the data is received, the parity bit is received and compared to see if it is correct. If it is correct, the subsequent device is notified to receive the data or store it in the buffer.
Since UART is asynchronous transmission and there is no transmission synchronization clock, in order to ensure the correctness of the data, UART uses a clock of 16 times the data baud rate for sampling. Each data has 16 clock samples, and the middle sampling value is taken to ensure that the sampling will not slip or error. Generally, the number of data bits in a UART frame is 8, so even if there is a clock error in each data, the receiving end can still sample the data correctly.
The timing of receiving data of UART is: when the falling edge of data is detected, it indicates that there is data to be transmitted on the line, and the counter CNT starts counting. When the counter is 24=16+8, the sampled value is the 0th bit of data; when the counter value is 40, the sampled value is the first bit of data, and so on, the next 6 data are sampled. If parity check is required, when the counter value is 152, the sampled value is the parity bit; when the counter value is 168, the sampled value is "1" indicating the stop bit, and data reception is completed.
Previous article:What is the FOC control algorithm?
Next article:Application of frequency converter in hot rolling bar line mill
Recommended ReadingLatest update time:2024-11-16 12:42
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- 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
- Where can I get an evaluation board for Toshiba's rice-sized Bluetooth module?
- 16. Low-power intelligent TWS in-ear detection chip VK233DS, Shenzhen Yongjia Microelectronics is the first choice
- [Atria AT32WB415 Series Bluetooth BLE 5.0 MCU] PWM breathing light
- 30V8A stepper motor driver, step angle 1.8 degrees, required accuracy 0.1 degrees, should I choose chip or H bridge
- Can the 66AK2L06 SoC enable miniaturization of test and measurement equipment?
- Circuit diagram of leakage alarm automatic control socket
- How to detect mosquitoes using ultrasonic sensor circuit
- 2021 National College Student Electronics Competition Released
- Share the application manuals, library functions, routines and selection tables of the full range of MM32 MCU products of Lingdong Microelectronics
- 【Construction Monitoring and Security System】Work Submission Post