HDLC and SDLC Protocol

HDLC (High-Level Data Link Control) is the ISO/IEC 13239 bit-oriented framing protocol behind X.25, ISDN, many telecom links and a lot of industrial and metering equipment. IBM's SDLC is its forerunner. Frames are marked by 0x7E flags, kept transparent by bit stuffing and protected by a CRC. A synchronous serial analyser such as the Lineeye LE-200PF decodes HDLC and SDLC on RS-232, RS-422 and RS-485 lines, and logic analysers with an HDLC decoder do the same on board-level signals.

Flag 0x7E01111110 opens and closes every frame
Bit stuffingA 0 after five 1s keeps data from looking like a flag
I, S and U framesData, supervision and link control
FCS16-bit CRC-CCITT or 32-bit CRC
SynchronousSeparate clock or NRZI coding with clock recovery
VariantsSDLC, LAPB, LAPD, PPP framing

How an HDLC Frame Is Built

HDLC frame: flag, address, control, information, frame check sequence, flagAn HDLC frame starts and ends with the flag 01111110 (0x7E). Between them are an address field of 8 bits or more, a control field of 8 or 16 bits, an optional information field of any length, and a 16-bit or 32-bit frame check sequence.Flag0x7EAddress8 bits+Control8 or 16 bitsInformationoptional, any lengthFCS16 or 32-bit CRCFlag0x7EBit stuffing between the flags: a 0 is inserted after any five consecutive 1s
Every frame sits between two flags. A single flag can close one frame and open the next.
  1. Flags: 01111110 marks the start and end of a frame. Idle links send continuous flags, or hold the line at 1 (mark idle).
  2. Bit stuffing: the transmitter inserts a 0 after any five consecutive 1s in the frame content, and the receiver removes it. Six 1s can only be a flag; seven or more are an abort.
  3. Address: identifies the secondary station. In normal response mode one primary polls many secondaries on a multi-drop line.
  4. Control: says what the frame is. Information (I) frames carry data with send and receive sequence numbers; supervisory (S) frames acknowledge or reject (RR, RNR, REJ, SREJ); unnumbered (U) frames set up and clear the link (SNRM, SABM, UA, DISC, DM, FRMR, UI).
  5. FCS: a CRC over address, control and information, usually the 16-bit CRC-CCITT (x16 + x12 + x5 + 1), sometimes 32-bit.

Variants You Will Meet

VariantWhere It Is UsedDifference From Basic HDLC
SDLCIBM SNA networks, older POS and banking equipmentPredecessor of HDLC, normal response mode, often NRZI line coding
LAPBX.25 packet networksBalanced mode between two equal stations
LAPDISDN D channel (ITU-T Q.921)Two-byte address with service and terminal identifiers
PPP in HDLC-like framingDial-up, serial links, some cellular modems (RFC 1662)Often asynchronous, with byte stuffing (0x7D escape) instead of bit stuffing
HDLC in DLMS/COSEMElectricity, gas and water meters (IEC 62056-46)Frame format type 3 with a length field, sent as asynchronous 8N1 characters over the optical port or RS-485

Where HDLC and SDLC Are Used

  • Telecoms: E1 and T1 signalling, ISDN, X.25 and legacy WAN links over V.35, X.21 and RS-530 interfaces.
  • Utility metering: DLMS/COSEM meters use HDLC framing on their optical and RS-485 ports.
  • Industrial and rail: multi-drop RS-485 links between controllers, drives and on-train equipment.
  • Embedded: microcontroller and SoC serial controllers with built-in HDLC framing for board-to-board links.

Common HDLC Faults and How to Find Them

SymptomLikely CauseWhat to Check
Every frame fails the FCSWrong CRC type or bit order, or the decoder uses NRZ on an NRZI lineConfirm 16 or 32-bit FCS and line coding in both ends' configuration
Frames decode as garbage after a few bytesBit stuffing not applied or not removedLook for runs of six 1s inside frames
Link never comes upMode set-up frames (SNRM or SABM) not answered with UADecode the U frames and check station addresses
Data repeated or lostSequence numbers out of step, REJ or timeoutsFollow N(S) and N(R) in the I and S frames over time
Errors at higher speed onlyClock edge or skew problem on the synchronous clockCapture data and clock together and check which edge samples the data

Tools for Analysing HDLC and SDLC

Watch tools capture the line and decode flags, fields and FCS. Drive tools can also act as one end of the link to simulate a station.

Serial Line Analyser

ProductRoleCapabilityPrice ex VAT
Lineeye LE-200PF Protocol AnalyserWatch DrivePC-connected or stand-alone logging analyser for RS-232C, RS-422 and RS-485, capturing bit-synchronous HDLC, SDLC and X.25 at up to 1.544 Mbit/s; the PC software also shows LAPD and PPP frames in its protocol translation view£1,020

Logic Analysers With HDLC Decoding

ProductRoleCapabilityPrice ex VAT
Acute TravelLogic 34-ChannelWatchLogic analyser running Acute's decoder library, which includes HDLC£1,260
ZeroPlus LAP-C Pro SeriesWatchLogic analyser with an HDLC decoder in ZeroPlus's decoder library; ask us to confirm it comes with your LAP-C Pro model£925

Working on V.35, X.21 or RS-530? Tell us the interface and clock rate and we will recommend an analyser and interface board.

Frequently Asked Questions

What Is the Difference Between HDLC and SDLC?

SDLC is IBM's earlier protocol; ISO built HDLC from it and added modes and options. The frame layout of flags, address, control and FCS is the same, so most analysers decode both.

Why Does HDLC Use Bit Stuffing?

So the flag pattern 01111110 can never appear inside a frame. After five 1s the transmitter inserts a 0, and the receiver removes it, so any data can be sent.

Is PPP the Same as HDLC?

PPP borrows HDLC-like framing: the 0x7E flag, an address of 0xFF, a control byte of 0x03 and an FCS. On asynchronous links it uses byte stuffing with a 0x7D escape instead of bit stuffing. RFC 1662 defines it.

Can a UART Decoder Read HDLC?

Only the asynchronous variants: PPP in HDLC-like framing (RFC 1662) and the HDLC used by DLMS/COSEM meters (IEC 62056-46), which sends each byte as an 8N1 character. Synchronous HDLC has no start and stop bits, so it needs a synchronous analyser or an HDLC decoder working on data and clock.

Which CRC Does HDLC Use?

Usually the 16-bit CRC-CCITT, polynomial x^16 + x^12 + x^5 + 1. ISO/IEC 13239 also allows a 32-bit FCS, so check both ends are configured the same way.

More Protocols

By John Legg CEng, Director, Debug Store. Updated 24 November 2026.