2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
advantage:Occupies fewer pins and has a low cost
shortcoming: Slow transmission speed
Applications:Long distance, low rate communication occasions
advantage: Fast transmission rate
shortcoming:Occupies many pins and has high cost
Applications: Short distance occasions.
Data can only be transferred in one direction.
Data can be transferred in both directions, but the transfer is time-sharing.
Data can be transmitted in both directions simultaneously.
Data transmission with clock port
There is no clock port, and the sender and receiver use their own clocks to control the data transmission and reception process.
Meaning: Universal Asynchronous Receiver/Transmitter, a serial data bus,It converts parallel data into serial data for transmission when sending data, and converts received serial data into parallel data when receiving data. Two signal lines are required to achieve this, one for serial port transmission and the other for serial port reception. The TXD and RXD between the two devices must be cross-connected.
1.Physical Layer: Interface type, level standard, etc.
2.Protocol Layer: Communication protocol (including data format, transmission rate, etc.)
UART During the sending or receiving process, a frame of data is composed of 4 Parts: start bit, data bit, parity bit and stop bit 。
Start bit: At the beginning of a frame, a low bit must be kept at a low level of 0.
Data bits: The data bits to be transmitted, the data bits can be selected from 5 to 8 bits, with LSB in front and MSB in the back.
Check Digit: Optional bit, occupies one bit, and can also be without check.
Stop bits: The end of a frame, required, optional, occupies 0.5/1/1.5/2 bits, maintains a logic high level.
Baud rate: The speed of serial communication is expressed in baud rate, which indicates the number of bits of binary data transmitted per second. The unit is bps (bits per second).Common baud rates are 9600、19200、38400, 57600 and 115200 wait.
UART is responsible for completing the serial-to-parallel conversion of data, while the signal transmission is realized by the external driver circuit. The transmission process of electrical signals has different level standards and interface specifications.Interface standardsRS232、RS422, RS485, etc., which define different electrical characteristics of the interface, such as RS-232 is a single-ended input and output, and RS-422/485 Differential input and output
The task of this experiment is to send data from the host computer to the Venusstar development board through the serial port debugging assistant. The end receives data through the USB_UART serial port and sends the received data to the host computer to complete the serial port data loopback. UART baud rate: 115200. Stop bit: 1, data bit 8, no parity bit.
In the uart_rx module: uart_rxd is the data received by the serial port, uart_rx_done indicates that the data conversion is completed (the data is converted from parallel data to serial data). uart_rx_data indicates the serial data after the conversion. Note: The received parallel data is 1 bit, and the converted serial data is 8 bits.
In the uart_tx module: uart_tx_dat indicates the 8-bit serial data that has been converted, uart_tx_en indicates that the data has been converted from parallel to serial, uart_txd indicates the parallel data after conversion, and uart_tx_busy indicates that the data is being converted from serial to parallel.
Because uart_rxd is an asynchronous signal and the start bit is low level, it is necessary to capture the falling edge change here, so it needs to be processed three times, so that the data receiving start bit signal can be obtainedstart_enThe signal indicates that parallel data is coming, and the parallel-to-serial conversion can be performed next;
rx_flagIndicates that the parallel data to serial data conversion is in progress, starting from start_en and ending when rx_cnt = 9 and baud_cnt reaches 216. This is to avoid the situation where the start bit of the next frame data comes before the end of the current frame data, so the stop bit is controlled at 0.5 bits;
baud_cnt:The system clock is 50Mhz, that is, 50000000, and the baud rate here is 115200, so 50000000/115200=434, that is, it takes 434 system clock cycles to transmit one bit of data, so the baud_cnt counter is needed.
rx_data:Because the serial data is 8 bits, it is better to add an index to facilitate finding a certain bit of data and assigning values. Therefore, rx_cnt is needed.
rx_data_t: Converted serial data.
uart_rx waveform
uart_tx_en: indicates that the serial data conversion is completed, that is, the uart_rx_done signal.
uart_data_t: Temporarily stores the converted serial data bits for subsequent transmission.
baud_cnt: Same as above.
tx_cnt: Same as above.
uart_tx waveform
uart_rx simulation waveform
uart_tx waveform simulation
uart overall waveform
Open the serial port debugging tool
Add debug attributes to the signals that need to be debugged, burn the program to the development board, and enter the following information in the serial port assistant.
Because the four-digit hexadecimal codes of 55 66 77 are 0101 0101, 0110 0110, 0111 0111.