1.Uart hardware introduction
UART stands for Universal Asynchronous Receiver and Transmitter. UART is mainly used for:
1. Print debugging
2. Data Transmission
The serial port can be connected through three wires: send, receive, and ground.
TxD of pc -> RxD of arm (UART write)
ARM's TxD -> PC's RxD (UART read)
2.uart parameters and formats
Baud rate: Indicates how many bits are transmitted per second, bits per second (bps). Generally, the baud rate options are 9600, 19200, 115200, etc.
Format:
Start bit: A logic "0" signal is sent first, indicating the beginning of data transmission.
Data bits: can be 5 to 8 bits of logical "0" or "1". Usually 7 bits, just enough to transmit all ASCII codes.
Check digit:
Odd parity: (parity bit + data bit) makes the number of "1" bits an odd number
Even parity: (parity bit + data bit) makes the number of "1" bits an even number
For example:
The ASCII value of 'A' is 0x41, which is 01000001 in binary. For odd parity, write '1' in the check bit, and for even parity, write '0' in the check bit.
Stop bit: It is the end mark of a character data.
3. How does UART transmit a character 'A'
The ASCII value of 'A' is 0x41, which is 01000001 in binary. How do we send these 8 bits of data to a PC?
1. Both parties agree on the baud rate (the time each bit takes)
2. Specify the transmission protocol
Now in this mode: arm's TxD -> pc's RxD (UART read)
1. The time when arm pulls down the uart bus 1 bit (start bit)
2. ARM drives the TxD level in turn according to the data bit, and PC reads the UART bus in turn. The data reaches the RxD pin of PC, and PC obtains the data bit in turn.
In order to transmit data over long distances, our PC uses RS-232 logic levels, while the ARM development board uses TTL/CMOS logic levels. Here we first explain what TTL logic levels are and what RS-232 logic levels are.
TTL/CMOS logic levels:
0 (low level 0-0.7v) represents logic '0'
1 (high level 2-5v) indicates logic '1'
RS-232 Logic Levels:
(+3V ~ +12V) indicates logic '0'
(-12V ~ -3V) indicates logic '1'
TTL logic level waveform:
RS232 logic level waveform:
Then the timing starts after the start signal begins, and the arm puts 1 bit of data to TxD every clock, and the pc also gets 1 bit of data from RxD.
arm pc
TxD=data[0:], data[0:]=RxD
TxD=data[1:], data[1:]=RxD
...
TxD=data[7:], data[7:]=RxD
Why RS232?
We know that the difference between the logic '0' and logic '1' of RS232 is larger than that of TTL/CMOS, so the logic level is not easily reversed, and it can be transmitted over a longer distance, so it is more commonly used in industry.
Therefore, the data obtained by the PC above is incorrect, so we need a TTL to RS232 level conversion chip.
4.How does the ARM chip send and receive data?
Sending data:
The memory puts the data into the transmit FIFO (64 bytes), and sends the data one bit at a time to TXDn through the transmit shifter, so that the PC can get the data from the bus one by one.
Receiving data:
When the TXDn terminal of the PC sends the data to the bus, the arm obtains the pin level of RXDn and gets the data in turn, puts it into the receive shifter bit by bit, then puts it into the FIFO and writes it to the memory.
Of course, you can also not use fifo and let the memory interact with the shifter directly, but this will waste memory resources, the memory frequency is very high, and reduce the memory throughput
Previous article:s3c2440 bare metal - UART programming - 2 - UART programming implementation
Next article:s3c2440 bare metal - clock programming - 2 - configure clock register
- Popular Resources
- Popular amplifiers
- Signal Integrity and Power Integrity Analysis (Eric Bogatin)
- Rohm LAPIS ML610Q111/Q112 Technical Specifications
- Design of serial communication between industrial control software Kingview and single-chip multi-machine
- New bus power supply/communication technology based on power electronic circuit topology
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
- GPCE4064B cannot be programmed
- “a data verification error occurred, file load failed” feasible solution
- Zhouyi Compass Simulation Experiment 2——Environment and Routine Analysis
- Collection! 19 methods and techniques for converting 5V to 3.3V
- Embedded C code optimization
- ESP32-S2-Saola-1 Review—by dcexpert
- Thank you for being there, thank you for the colorful life in the year
- Does anyone know about ST's new MPU? The model is STM32MP157A
- BlueNRG-x Documentation - Free Development Compiler Tool
- Guihang Shares Huayang Electric Co., Ltd. recruits embedded software and hardware engineers