I. RTS and CTS in the RS232 standard
rts,cts------Request Send/clear send, for half-double hours of transceiver switching, belongs to the auxiliary flow control signal. Half-duplex means to say that when the hair is not received, when the collection is not sent. So how do you differentiate between sending and receiving? By default, the DCE sends data to the DTE, and when DTE decides to send data to DCE, the RTS is valid, indicating that the DTE wants to send to the DCE. The general DCE is not able to convert the transmit/receive status immediately, and DTE can determine if the CTS is valid, thus avoiding the loss of data caused by the DTE being sent when the DCE is not ready.
Second, the modem hardware flow control in the RTS and CTS
According to Simcom's explanation, the RTS and CTS are independent,
1.RTS is the input side of the module for the MCU notification module, whether the MCU is ready, whether the module can send information to the MCU, RTS effective level is low.
2.CTS is the output of the module for the module to notify the MCU, whether the module is ready, whether the MCU can send information to the module, the effective level of the CTS is low
From the text, RTS and CTS are independent and there is no initiator problem for each unidirectional data transfer. If the host output RTS is valid, then the module has data will be sent to the host, if the module output CTS is valid, then the host can send the data delivery module to receive.
Iii. RTS and CTS in communication protocols
The Rts/cts protocol, the request Send/Allow Send protocol, is the equivalent of a handshake protocol that is primarily used to resolve "hidden terminal" issues. "Hidden Terminal" (Hidden stations) refers to the base station A to the base station B to send information, base station C does not detect a also send to B, so a and C at the same time send the signal to B, causing a signal conflict, resulting in the signal sent to B is lost. "Hidden terminal" occurs in large units (typically in outdoor environments), which leads to loss of efficiency and requires an error recovery mechanism. When the need to transfer large-capacity files, especially the need to eliminate the "hidden terminal" phenomenon occurs. IEEE802.11 offers the following solutions. In the parameter configuration, if the Rts/cts protocol is used, and the maximum number of bytes is set at the same time----the Rts/cts handshake protocol is initiated once the data to be transmitted is greater than this upper limit: First, a sends an RTS signal to B, indicating that a sends some data to B, and B receives the RTS, A CTS signal to all base stations indicates that it is ready, a can be sent, the rest of the base station temporarily "sit still", then A to B to send data, and finally, b after receiving the data, that is, all the base station broadcast ACK acknowledgement frame, so that all the base station again can be equal to listen, competing channels.
Attached: UART serial port History
A long time ago, the computer has not appeared, then already existed (computer) prehistoric serial equipment (telex typewriter, industrial measurement equipment, communication modems), in order to connect these serial ports, EIA developed the RS232 standard, using DB25 Connector, support synchronous and asynchronous serial port, The D-type interface can effectively prevent plug-in. Standardization has brought convenience to use.
With the advent of the PC, these existing serial devices have undoubtedly become the original peripherals, and naturally the RS232 standard is adopted by the PC. But device manufacturers tend to have smaller, lower-cost interfaces, so the DB25 and support for synchronous mode pins are removed to form DB9. The initial situation was quite chaotic because the DB9 only defined the signal, but did not specify the corresponding relationship between the signal and the pin, each manufacturer can only define itself. Fortunately, IBM's PC became an industry standard, and DB9 gradually unified into IBM's definition.
DB9 has only 9 lines and follows the RS232 standard. Defined as follows:
DTR,DSR------DTE Device Ready/DCE equipment ready. Mainstream control signals.
rts,cts------Request Send/clear send. For half-double work, send and receive switching. belongs to the auxiliary flow control signal. Half-duplex means to say that when the hair is not received, when the collection is not sent. So how do you differentiate between sending and receiving? By default, the DCE sends data to the DTE, and when DTE decides to send data to DCE, the RTS is valid, indicating that the DTE expects to be sent to the DCE, and that the DCE cannot immediately convert the send and receive status, and DTE can determine if the CTS is valid to see if it can be sent. This avoids the loss of data caused by the DTE being sent when the DCE is not ready. Full double working hours, these two signals have been valid.
With the increasing popularity of computers, many non-RS232 serial ports to access the PC, if for each new serial port to add a new I/O port is obviously not realistic, because the PC rear panel position is limited, therefore, will RS232 serial and non-RS232 serial port through RS232 port access is the best solution. The UART U (General) refers to this meaning. Early ROM BIOS and DOS communication software are designed for RS232, no data is sent until the DCD is detected, so a simple application such as sending a character will give the control signals of DCD, DTR, and DSR. Therefore, the serial port connector to some of the control line short, or simply bypass the system software to write their own communications program.
To this, the meaning of the UART is summed up as: Universal asynchronous (serial) I/O port.
At the time the UART was crowned with general-purpose unified, the manufacturers were dissatisfied with its speed, volume and flexibility (software configurable), introducing USB and 1394 serial ports. At present, the UART serial port on the notebook has been canceled trend, so there are netizens issued a "No serial port, I Who and return" sigh of regret, the ancient and modern how many things, all pay a joke, the USB to replace the UART is something, for the time being.
Since Hayes (Hayes) has introduced smart cats (SmartModem), their modem interface has become the industry standard, since then, all companies to make compatible cats are in line with the Hayes standard (even at the command is also compatible).
The modem serial port developed by RS232 is very different from that of the standard. DTR is maintained throughout the communication process, the DSR in the modem power on/can dial before the effective (depending on the software to the DSR understanding), at any time in the communication process, as long as the DTR/DSR invalid, the communication process immediately terminated. In a sense, this can also be considered as flow control, but certainly not the kind of mainstream control that RS232 refers to. If you are stuck with RS232, you will not understand the use of DTR and DSR.
Hayes not only changed DTR and DSR, even the meaning of RTS and CTS has been redefined. Therefore, RTS and CTS do not have the first meaning. From the literal understanding of RTS and CTS, is used for half-duplex communication, when the DTE wants to change from the receiving mode to send mode, the effective RTS request sent, DCE received the RTS request can not immediately complete the conversion, it takes some time, and then the effective CTS notification DTE:DCE has been transferred to the hair mode, The DTE can start sending. Both RTS and CTS are set to be valid by default in full-duplex hours. However, in the Hayes Modem serial definition, the RTS and CTS are used for hardware flow control, and what is the full/half duplex point relationship does not have. Note that hardware flow control is realized by software, the reason is to emphasize the word "hardware", only because the hardware flow control provides the hardware connection for the traffic situation indication, is not to say, you just connect the line, the hardware can flow control. If the software is not supported, the optical connection to RTS and CTS is useless.
The software algorithm of the RTS and CTS hardware flow control is as follows: (RTS effectively indicates that the PC can be received, the CTS effectively indicates that the modem can be received, the two signals are independent, indicating the flow situation in one direction.) )
PC-Side processing:
When found (not necessarily in time) CTS ( -3v to-15v) Invalid, stop sending,
When discovery (not necessarily in time) CTS (3v to 15v) is valid, resume sending;
0 when receiving the bytes in buffers when receiving bytes>n in buffers, the RTS is not signaled ( -3v to-15v);
Modem Terminal Processing:
Ditto, but RTS is exchanged with CTS.
The CTS and RTS have a definite meaning in RS232, but since Hayes (HAYES) introduced the Smart Cat (SmartModem), it was a bit confusing. In RS232, the RTS and CTS are used for direction switching in half-duplex mode, and the CTS in HAYES modem is used for hardware flow control. Usually the meaning of the RTC andCTS of the UART refers to the latter, which is used for hard-flow control.
Hard-flow-controlled RTS , CTS : RTS (Require to Send, Send the request) as an output signal to indicate that the device is ready to be received; the CTS (Clear to send, send purge) is the input signal and stops sending when it is valid. Assume that a, B devices communicate, a device's RTS Connect b devices CTS ;a devices CTS Connect B devices RTS . The previous signal controls the transmission of the B device, and the rear signal controls the transmission of a device. For the transmission of the B device (a device receive), if the a device receives a buffer that is fast-filled, issue RTS signal (meaning notification B device stops sending), B device through CTS The signal is detected and stopped; After a while the a device receives a buffer that is free, issue an RTS signal indicating that the B device starts sending data. A device is sent (b device receives) similar. The above functions can also be implemented by inserting Xoff (special characters) and Xon (another special character) signal into the data stream. A device once received the Xoff sent by the B device, immediately stop sending; Conversely, if you receive the Xon sent by the B device, the data is sent back to the B device. Similarly, b devices are similar, thus achieving speed matching between the receiving and transmitting parties.
Half-duplex directional switching: RS232 uses DTR (Date Terminal ready, Data terminal preparation) to mainstream control over the DSR (data Set ready, which is well-equipped), similar to the aforementioned RTS and CTS . The DTE (Date Terminal equipment, Data terminal device) of the half-duplex communication is the default direction that the DTE receives, the DCE sends, in the case of the DCE (circuit equipment). If the DTE is to send data, an RTS signal must be issued to request the data to be sent. When the DCE is received, the CTS responds to the RTS signal, indicating a response to the request, so that the direction of communication becomes dte->tce, while the RTS and CTS signals must be maintained. As can be seen from here,CTS , TRS Although also a bit of the meaning of flow control (such as the CTS is not issued, DTE can not send data), but mainly for the direction of switching.
If the UART only RX, TX two signal, to flow control can only be soft flow control, if there is Rx,tx,CTS ,RTS Four signal, it is mostly supported by the hard-flow control of the UART; if there is Rx,tx,CTS , RTS , DTR,DSR Six signals, the likelihood of a RS232 standard is relatively large.
By the way:
DCD (Data Carrier Detect): DCE indicates to DTE that the carrier is detected on the line.
RI (ring Indicator, ringing indication): DCE indicates to DTE, there is call access.
==================================== I'm a split line ====================================================================== ===============================
"Turn" RTS and the meaning of CTS