Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
High-Level Data Link Control
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Framing== HDLC [[data frame|frames]] can be transmitted over [[Synchronous serial communication|synchronous]] or [[asynchronous serial communication]] links. Those links have no mechanism to mark the beginning or end of a frame, so the beginning and end of each frame has to be identified. This is done by using a unique sequence of bits as a frame delimiter, or ''flag'', and encoding the data to ensure that the flag sequence is never seen inside a frame. Each frame begins and ends with a frame delimiter. A frame delimiter at the end of a frame may also mark the start of the next frame. On both synchronous and asynchronous links, the flag sequence is binary "01111110", or [[hexadecimal]] 0x7E, but the details are quite different. === Synchronous framing === Because a flag sequence consists of six consecutive 1-bits, other data is coded to ensure that it never contains more than five 1-bits in a row. This is done by [[bit stuffing]]: any time that five consecutive 1-bits appear in the transmitted data, the data is paused and a 0-bit is transmitted. The receiving device knows that this is being done, and after seeing five 1-bits in a row, a following 0-bit is stripped out of the received data. If instead the sixth bit is 1, this is either a flag (if the seventh bit is 0), or an error (if the seventh bit is 1). In the latter case, the frame receive procedure is aborted, to be restarted when a flag is next seen. This bit-stuffing serves a second purpose, that of ensuring a sufficient number of signal transitions. On synchronous links, the data is [[NRZI#Non-return-to-zero inverted|NRZI]] encoded, so that a 0-bit is transmitted as a change in the signal on the line, and a 1-bit is sent as no change. Thus, each 0 bit provides an opportunity for a receiving [[modem]] to synchronize its clock via a [[phase-locked loop]]. If there are too many 1-bits in a row, the receiver can lose count. Bit-stuffing provides a minimum of one transition per six bit times during transmission of data, and one transition per seven bit times during transmission of a flag. When no frames are being transmitted on a simplex or full-duplex synchronous link, a frame delimiter is continuously transmitted on the link. This generates one of two continuous waveforms, depending on the initial state: [[File:NrziEncodedFlags.png]] The HDLC specification allows the 0-bit at the end of a frame delimiter to be shared with the start of the next frame delimiter, i.e. "011111101111110". Some hardware does not support this. For half-duplex or multi-drop communication, where several transmitters share a line, a receiver on the line will see continuous idling 1-bits in the inter-frame period when no transmitter is active. HDLC transmits bytes of data with the least significant bit first (not to be confused with [[little-endian]] order, which refers to byte ordering within a multi-byte field). === Asynchronous framing === When using asynchronous serial communication such as standard [[RS-232]] [[serial port]]s, synchronous-style bit stuffing is inappropriate for several reasons: * Bit stuffing is not needed to ensure an adequate number of transitions, as start and stop bits provide that, * Because the data is [[Non-return-to-zero|NRZ]] encoded for transmission, rather than NRZI encoded, the encoded waveform is different, * RS-232 sends bits in groups of 8, making adding single bits very awkward, and * For the same reason, it is only necessary to specially code flag ''bytes''; it is not necessary to worry about the bit pattern straddling multiple bytes. Instead asynchronous framing uses "control-octet transparency", also called "[[byte stuffing]]" or "octet stuffing". The frame boundary octet is 01111110, (0x7E in [[hexadecimal]] notation). A "control [[Escape character|escape octet]]", has the value 0x7D (bit sequence '10111110', as RS-232 transmits least-significant bit first). If either of these two octets appears in the transmitted data, an escape octet is sent, followed by the original data octet with bit 5 inverted. For example, the byte 0x7E would be transmitted as 0x7D 0x5E ("10111110 01111010"). Other reserved octet values (such as [[Xon/Xoff|XON or XOFF]]) can be escaped in the same way if necessary. The "abort sequence" 0x7D 0x7E ends a packet with an incomplete byte-stuff sequence, forcing the receiver to detect an error. This can be used to abort packet transmission with no chance the partial packet will be interpreted as valid by the receiver.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)