*In the field of communications, there are two types of data communication: parallel communication and serial communication
【UTXHn/URXHn】
Keywords:ARM
Reference address:ARM Serial Interface Circuit
*Serial port data transmission is carried out in serial mode. In data communication, the serial port only transmits one bit of data at a time.
*The transmission speed of serial data is described in bps or baud rate
【UART】
When sending data, the CPU writes the data into the UART, and the UART sends it out from a serial port on a pin TxD according to a certain format;
When receiving data, the UART detects the signal on another pin RxD and puts the serial data in a buffer so that the CPU can read it.
(UARTs transmit data in full-duplex mode)
UART uses standard TTL/CMOS logic levels to represent data
*0-5v, 0-3.3v, 0-2.5v or 0-1.8v
*High level means 1, low level means 0
However, in the peripheral level, in order to enhance the data's anti-interference ability and increase the transmission length, the TTL/CMOS logic level is usually converted to the RS-232 logic level. For example, the level conversion chip can be used: MAX3232
RS-232 logic level (inverse logic)
3-12V: indicates 0
-3~-12V: indicates 1
Preparation before data transmission (agree on baud rate and transmission format)
*How many data bits are there?
*Whether to use check digit
*Is it odd or even parity?
*How many stop bits are there?
【Odd/Even Parity】
Odd parity check: It means that the number of 1s in the original data sequence (including the bit you want to add) is an odd number;
1000110 (0) You must add 0 so that the original 3 1s are already an odd number, so adding 0 still makes it an odd number;
Even parity: It means that the number of 1s in the original data sequence (including the bit you want to add) is an even number;
1000110 (1) You must add 1 so that the original 3 1s are already an odd number, so adding 1 still makes it an odd number;
【Stop bit】
Idle bits between valid frames;
【Asynchronous data transmission method】
When sending data, the SOC first writes the data into the transmit FIFO, and then the UART automatically copies the FIFO data to the transmit shifter, which sends the data one bit at a time to the TxDn data line.
When receiving data, the receive shifter receives the data on the RxDn data line one bit at a time, and then copies it to the receive FIFO, from which the SOC can read the data.
Hardware flow control
*If serial port hardware flow control is turned on, serial port A can send data only after nCTS is activated (nRTS of serial port B);
*When serial port A can receive data, activate nRTS and prepare to receive data
【UBRDIVn】
* In the UART module, there are three UART baud rate divisor registers UBRDIV0, UBRDIV1, UBRDIV2. The value stored in the baud rate divisor register UBRDIVn is used to determine the baud rate.
UBRDIVn = (int)(UART Clock / (buad rate*16))- 1
【ULCON】
【UCONn】(Select UART clock source, set UART interrupt mode)
[UFCONn] (This register is used to set whether to use FIFO and set the trigger depth of each FIFO)
[UTRSTATn register]
(Used to indicate whether the data has been sent and whether the data has been received)
【UTXHn/URXHn】
UTXHn register: SOC writes data to this register, UART saves it to the transmit shift register and automatically sends it out
URXHn register: When UART receives data, SOC reads this register to obtain the data.
Previous article:ARM·Power circuit/Reset circuit/GPIO
Next article:ARM UART initialization program
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- 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
Guess you like
- MicroPython adds support for STM32L432KC
- What to do if the microwave membrane switch fails
- STM32G474RET6, using HRTIM, outputs dual-channel Dual DAC sine waves in DMA mode
- December 3 live broadcast review: MPS inductor solutions help better switching power supply design
- Several countermeasures to suppress electromagnetic interference of power modules
- Design of a data channel model for an 8-bit embedded RISC MCU IP core
- Theory and Application of DAC12 Module of MSP430 Microcontroller
- CC1310 switching rate method
- [RVB2601 Creative Application Development] Build a Personal Cloud Music Player
- Updated SensorTile firmware