Chapter 7 : SDLC and HDLC

[ SDLC vs. BISYNC/BSC | SDLC Frame |

Note: We will consider SDLC and HDLC the same, until their main differences are specified in this document.


1: SDLC is bit oriented. LSC is character oriented which is suitable for text. While SDLC can be used over text and binary information.

2: BSC is Stop-and-Wait (half-duplex) protocol, while SDLC and HDLC are Go-Back-n or Selective-repeat (Full-duplex) ARQs protocols. In other words BSC requires frames to be acknowledged individually, while SDLC allows multiple acknowledgments.

7.2 SDLC Frame

Figure S.1 SDLC Frame (frame)

  • sync: a special bit pattern to signify the beginning and the ending of a frame.
  • address: In primary-secondary setup address contains the secondary station address. (1 or more bytes)
  • control: 1 or more octets (explained later)
  • data: variable length data field. For DLC it is only data, for the upper layer it may be data+header.
  • CRC: Cyclic redundancy check (16 bits) may use the following: CRC-CCITT (16 bits) CRC-16 (16 bits)

7.2.1 Flag pattern

The receiver must be capable of recognizing the flag pattern as the opening or closing a frame in each of the following sequence:

1: Frames separated by two contiguous flags

Figure S.2 Combined Close/Open Flag (pattern)

2: Only one flag is transmitted between two frames. It functions as a closing frame for the leading frame and opening frame for the trailing frame. These two frames may not be directed to the same receiver.

3:The closing flag of one frame shares a ZERO bit with the opening flag of the next frame. In other words a ZERO bit COMMON to contiguous flag.

Figure S.3 Zero Bit Common Contiguous Flag (flag 1)

The receiver must be capable of recognizing all the flag patterns. It is not necessary that a transmitter be capable of transmitting all flag combinations for contiguous frames.

8.2.2 SDLC bit-stuffing

A procedure called bit-stuffing is used to ensure that the sync(flag) byte does not occur any where in the rest of the frame. When a frame is being transmitted, the packet is checked that if there are 5 consecutive "1"s, the sending machine will insert a "0" after 5 "1"s.

So between the opening and closing flags a transmitter inserts a ZERO after 5 "1" bits. After recognizing the opening flag, a receiver is required to delete any zero bit follows five contiguous "1" bits. The bit stream must pass through the flag circuitry of the receiver before the inserted zeros are deleted. SDLC will delete the "0" bit, before giving the packet to the upper layers.

Figure S.4 Receiver Must Detect Flag First (flag2)

8.2.3 Command and Response Frames

A frame transmitted by primary is considered "Command" and a frame sent by secondary is called "Response".

Figure S.5 Commands and Responses (command)

8.3 SDLC/HDLC Modes of operation

A secondary station can find itself in the following modes at any given time:

1: Normal Response Mode

2: Asynchronous Response Mode

3: Asynchronous Balance Mode

4: Normal Disconnected Mode

5: Initialization Mode

8.3.1 Extended mode

Here the sequence numbers are 0-127. The other modes have 0-7 sequence numbers allowed.

8.3.2 Normal Response Mode

In a primary-secondary set up this is the mode of secondary station. A secondary can only transmit only in response to the command frame from primary. A secondary can send one or more frames.

Figure S.6 Normal Response Mode (NRM)

0.3.3 Asynchronous Response Mode

Here a secondary can transmit aframe without being polled by the primary.

Figure S.7 Asynchronous Response Mode (ARM)

0.3.4 Asynchronous Balanced Mode

In this mode there is no primary-secondary set up. Any station can initiate a transmission. This is equivalent to LAP-8 (link-access- protocol Balanced mode) used if LANs.

Figure S.8 Asynchronous Response Mode (abm)

0.3.5 Normal Disconnected Mode

In this mode a secondary is "logically" disconnected trom the link. The secondary in this mode cannot receive any data or transmit any data frames. The only frames it can accspt or transmit are certain control frames. in order to change its current mode etc.

0.3.6 Initialization mode

A secondary is in initialization mode, before it it is operational. Special U (Un-numbered) commands are used to change the secondary station from Initialization mode to e.g. Normal Response Mode.

0.3.7 Station's Response Opportunity

o Response opportunities identifies the conditions that must exist to permit a station to transmit a response.

o Three response opportunities may be used within SDLC. NRM, Asynchronous response opportunity and the asynchronous balanced response opportunity.

0.4 Control Byte and Frame Types

Figure S.9 Control Byte Format (cbyte)

The non-sequenced (also known as Un-numbered) frame are some times used for supervisory control functions and also may be used to contain an information field. There are two formats of packets STANDARD and SHORT. The only difference between the two is that standard form contains the INFORMATION field, short is a SUPERVISORY or NS frame.

A frame less than 32 bits in length will be considered invalid, this minimum length is that of a short frame contains address field control and CRC fields.

You might have noticed that l-frame has both Ns and Nr fields, S-trames only contain Nr, and U-trames don't contain any sequence number at all.

Ns is the sequence number of the current frame. Nr is that what is the next sequence number a receiver node is expecting. We assume that when two nodes begin to communicate they start with Ns and Nr = O. Ns and Nr used for flow control.

Assume that Node A and B started communicating with Ns and Nr both "0". See they update their Ns field afler transmitting an I frame. Now look at the trame sent by Node B which was damaged. Node A does not update Nr, from that packet onwards. But Node B doesn't know about it, and it keeps sending data packets with updated Ns. Now when Node A send an S frame it does not bump up its Ns count, since it is only a supervisory frame. After this frame is received by the receiver, the receiver updates it Ns count back to "1". This scheme is using Go-Back-n ARQ.

0.4.1 Supervisory Frame Types

Figure S.11 Supervisory Frame Formats (s-frame)

Bit 3 & 4 give 4 possible S-frames: 00 - RR Receiver ready

01 - REJ Reject

10 - RNR Receiver Not Ready

11 - SREJ Selective Reject HDLC 8 later versions of SDLC RR-Receiver Ready

It may be used by primary as a poll message to a secondary. Nr means that I am expecting frame num Nr from you. If the secondary does not have any message it will again send a RR frame. If secondary has data, then it will send an I frame instead. An RR frame can also be sent as an acknowledgment frame. RNR-Receiver not ready

This may be send by a primary or secondary, mentioning that the next packet I am expecting is Nr, but don't send me any more packets yet. Later an RR may be sent to show willingness to accept packets. REJ-Reject

This can be sent by primary or secondary, reporting a damaged packet Nr. It means that now the transmitter has to retransmit all the frames starting from Nr and onwards. This type of supervisory frame is only used for G-back-N-steps ARQ, and not for Selective-Repeat. SREJ-Selective reject

In this case only Nr will be retransmitted from the primary.

0.4.2 Poll/Final (P/F) bit (bit 5)

When the frame is sent by the primary station, this bit is called the POLL bit. Whenever the P bit is "1" on a "Command" frame, it asking from the secondary to send a response frame. When the frame is "Response" frame, this bit is called the FINAL bit, it requests an acknowledgment from the primary. Basically P/f serves the same purpose, either on the Command or Response frame. It means the the sender is expecting an answer betore it resumes its transmission again.

0.5 Stations hierarchy

Two modes are popularprimary-secondary and balanced.

0.5.1 Primary and Secondary Relationship

In tree structure network topologies, on some channels station might act like Primary, on the other link(s) it may act like a secondary.

Figure S.13 Primary and Secondary Nodes Hierarchy (hierar)

The primary station maintains responsibility for the initiation of the error recovery procedures.

0.5.2 Balanced Relationship

In a complex communication network, all communications may be routed through communication processors which will function as a "Switching Nodes". It will be their function to control the routing and flow of data in the network. They will share an equal level of link authority within the network and are called COMBINED stations. This happens in a BALANCED mode.

Figure S.14 Combined Nodes In a Balanced Relationship (balanced)

0.6 Type of addressing

The address field of a command frame contains identifies the secondary to which is being transmitted. The address trame from the secondary (response) identifies the originating secondary.

There are three kinds of addressing possible:

(1) individual address (2) group address (3) global address

The individual address will identify only and only one secondary on the link. The group address will identify group of secondaries on a link. (An example is down stream loading of a program). The global address is for all the secondaries on the link.

Figure S.15 Type of Addressing (address)

Here all the secondaries will receive broadcast address "F" If a group address of "A" is sent, then S1 and S3 will pick up the message. If individual address "5" is sent, then only S5 will receive the frame.

o If the address field contains HEX "FF " it is a GLOBAL ADDRESS. o It the least signiticant 4 bits of the address tield contains "1" the address is considered to be GROUP address. This provides the ability to encode fifteen specific group addresses (in the most significant 4 bits ot address field).

0.7 Station operating states

Three operating states are defined tor a secondary station, and within each state, one or more operating modes. If the operating mode is NORMAL then, it simply means that the secondary cannot transmit until polled by the primary, without regard to its operating state. If the mode is asynchronous or asynchronous balanced, the secondary can transmit spontaneously if the channel has been established. Following are the states:

0.7.1 Logically Disconnected State

Can be considered IDLE state of a secondary. It is not necessary that a secondary be physically disconnected trom the channel when in this state. Any one of the tollowing can cause the secondary to enter the LDS (logically disconnected state):

1. Initial power up

2. Recover trom a temporary power loss

3. Manual Reset

4. Receipt of a DISCONNECT command trom the primary

A secondary in LDS is capable of monitoring the channel if the physical connection is established. tf a secondary receives a command trom the primary while monitoring the channel (LDS); it will respond. The purpose of the response will be to notify the primary that its is in the LDS.

A mode setting command trom the primary is required trom the secondary to exit the LDS. A mode setting command will instruct the secondary to go to INITIALIZATION (IS) or INFORMATION TRANSFER STATE (ITS).

The operating mode of a secondary in the LDS, Nommal disconnected or Asynchronous Disconnected will be detemmined by its own software or tinmware. Any time it enters the LDS, it will resume this operating mode.

0.7.2 Initialization State (IS)

Initalization is a process by which a secondary is conditioned to perform its functions. The initialization can be accomplished by a program load at the secondary, or it may require a "downstream load" trom the primary.

A secondary requiring initialization from the primary will await his initalization in the LDS. It is very important to note that a secondary, which has not yet received its opening program by downstream load, must have the ability to assume the LDS and recognize commands from the primary.

The expected command from the primary is one that instructs the secondary to go to the initialization state (IS). if any other command is recsived, the secondary will respond with a "REQUEST FOR INITIALIZATION" which is an un-numbered frame type.

A secondary that has been initialized will remain in "IS" until it receives a mode stetting command trom the primary. In this case the command would be one that instructs the secondary to go to the infommation transfer state (ITS) or logically disconnected state (LDS).

0.7.3 Information Transfer State

In this state the secondary is capable of pertorming all functions required to handle the transfer of data. The secondary will enter the ITS upon command from the primary. If initialized, the secondary can be instructed to go to the ITS trom the LDS. It can also be instructed to go to the ITS trom the (IS), once initialization is complete.

A secondary will exit ITS when it receives a "DISCONNECT" command which is an un numbered frame.

0.8 Inactive Periods and Line Idle Sequence

During normal communications, situations may develop that result periods of inactivity.

0.8.1 Interframe Time Fill

In this situation, a station that has been transmitting trames has stopped, but does intend to resume within a definite period. This delay could be result of a need to call additional data from a file device. These stations are required to transmit continuous FLAG sequences. By this transmission, the station is maintaining its right to use the channel. If the secondary is operating in TWA or a multi-point environment, the length of time till can be transmitted is limited, e.g. following are the absolute maximums:

1: for data rates less than 20 K bps, active idle is limited to 25 milli-sec. 2: for data grater than 20 K bps, active idle is limited to 10 milli-sec.

0.8.2 Idle Sequence and Channel Disconnect

Either of these sequences will indicate that station has no more trames to transmit:

The idle sequence is signaled by the transmission of 15 contiguous one bits.

The receiver will recognize the idle sequence by detecting 15 contiguous one bits. However, these 15 bits must be received while the Data Carrier Detect is active. This will distinguish between the legimate idle sequence and the 1's that will appear on the Receive Data Lead as a result of clamping it to the MARK state when the Carrier is lost.

If the carrier is dropped after transmission of the idle sequence, the receiver will consider this to be "channel termination".

While the "idle sequence" indicates that a station has no more frames to transmit, "channel termination" indicates that the station is also giving up its right to use the channel.

Secondary stations in a tourwire multi-point configuration wiil drop carrier after transmitting the idle sequence, but primary will not.

Both stations are required to drop carrier after the idle sequence transmission in a two wire point-to-point circuit.

The stations are not required to drop the carrier after the idle sequence in a four wire point-to-point circuit.

0.8.3 Abort Sequence

The "abort" sequence will be transmitted by the station when it wishes to end a trame in a manner that will cause it to be ignored by the receiver. The transmitter will send 8 contiguous "1" bits (no zero insertion). The receiver will recognize 7 contiguous 1 bits as an abort. The need to abort could be the result of a failure at the transmitting station, which makes it impossible to complete transmission of a frame in a normal manner.