UART communication Flow Control Method

Source: Internet
Author: User

Before talking about this, we will first introduce another concept, DCE (Data Communication Equipment) speed. It refers to the transmission speed between two modem devices, that is, between telephone lines. We call 56k the speed. DTE (data terminal equipment) refers to the transmission speed from the local computer to the modem. If the telephone line transmission rate (DCE speed) is 56000bps, after receiving the data, the modem decompress 56000 × 4 = 115200bps according to the v.42 bis protocol, and then transmit the data to the computer at this rate. This shows that the 56k CAT (using v.42bis) the speed of DTE must reach 115200bps in ideal conditions.

Flow Control)

From the above introduction, we have learned that there is a great difference between the speed of DTE and DCE. In this way, the recipient may not be able to receive the data during the transmission and receipt process, in this case, you need to control the sender to avoid data loss. This process is called traffic control. Two control methods are available: Xon/xoff and CTS/RTS. The former is generated by the software and added to the data stream. xoff indicates stop sending and Xon indicates continue sending. This method is usually used for low-speed cats around 24 bps. CTS (clear to send)/RTS (request to send) implements traffic control through the signal line between the computer and modem, that is, the hardware method. The request sending signal (RTS) is generated by the computer, which notifies the modem to send data, and clears the sending signal (CTS), which is generated by the modem and notifies the computer to transmit data. because hardware control is faster than software, it is mostly used for high-speed modem. Hardware should also be used for MNP, v.42, and fax.

CTS (clear to send) allows sending. It is incorrect to translate many articles into clear messages.

CTS is the response to the RTS.

A sends an RTS signal to B, indicating that a wants to send some data to B. B sends a CTS signal to all base stations after receiving the RTS, indicating that a is ready and a can send

CTS and RTS are two pins controlled in the serial communication flow, which appear in pairs. Shows the general connection method:

Figure 2 UART Flow Control.

Specifically, when the receiver (uart2) deems it acceptable to accept UART data, the RTS is set to a valid bit. The CTS pin of the sender (uart1) receives this signal before sending the data. Generally, when the UART data receiving cache is larger than two bytes free, you can set RTS to receive data effectively. Of course, the UART receiving buffer of od2101 has 64-bit bytes. You can define the RTS according to your data traffic requirements.

I. Remote Communication

In 1st and 2nd, it is an example of long-distance communication (communication with a transmission distance greater than 15 m). Therefore, a modem must be added, so there are many signal lines. Note: In the following figures, the DTE signal is a RS-232-C signal, and the level conversion circuit between the DTE and the computer is not drawn.

1. Signal connection when modem (DCE) is used for communication with the telephone network:

If a common telephone exchange line is used between the modem and the modem ~ The RI (22) and DTR (20) signal lines must be added to the signal line 8, as shown in figure 1:


Figure 1

DSR and DTR: the data transmission machine (DCE) is ready, and the data terminal (DTE) is ready, which only indicates that the device is available.

First, call each other through Telephone Dialing. The telephone exchange station sends a dialing call signal to the other party. When the other party's DCE receives the call signal, the RI (Ringing signal) is valid and the DTE is notified, called. After the other party "disconnects", the two parties establish a communication link.

If the computer wants to send data to the other party, it first sends the RTS (request sending) signal through the interface circuit (DTE. In this case, if the DCE (modem) allows transmission, it will reply to the dte cts (allows sending) signal. Generally, you can directly connect the RTS/CTS to a high level, that is, the signal can be transmitted as long as the communication link has been established. (RTS/CTS can be used only for switching between sending and receiving modes in half-duplex systems.

After the DTE obtains the CTS signal, it sends a serial signal to the DCE through the txd line. The DCE (modem) modulated these digital signals into analog signals (also known as carrier signals) and transmits them to the other party.

Before the computer transfers new data to the DTE "data output register", it should check that the modem status and data output register are empty. When the DCE of the other party receives the carrier signal, it sends a DCD signal (data carrier detection) to the other party's DTE to notify the other party to prepare for receiving the DTE. At the same time, it decrypts the carrier signal into a data signal, the DTE is sent to the DTE online from the rxd. The DTE is switched to the received bit stream through the serial receiving shift register. After receiving all the bit streams of 1 character, send the data bit of this character to the data input register. The CPU can read the character from the data input register.

2. Use a dedicated telephone line for communication: use a telephone line between the modem of both parties ~ Contact and control the signal line 8. There is no need for telephones, zhenling signals RI and DTR signals. The connection of the signal line 2 is the same.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.