Technology   • Technology •

< Technology

> Intro

> Polynomial

> Calculation

• Examples


— FCS (CRC): Examples —

Example HDLC Frame for PPP

Here is a HDLC frame I captured. I had two computers, each connected to a modem, the modems were connected to my small in-house telephone exchange. Computer 1 running Windows called computer 2 with the RAS service (PPP) just as if it would call up an ISP (Internet Service provider). The modem of computer 2 answered the call, on the computer run a small packet capture program I wrote. The initiating computer sent 10 PPP packets until it gave up with the message, that it would get no answer. Of course, I had not programmed computer 2 to answer the PPP request. I could analyze the captured PPP HDLC frame, though.

ESC Enc. Data Remarks
  7e Start of HDLC frame
  ff Address field: address all
7d 23 03 Escaped encapsuled control byte
  c0 Start of LCP
(Link Control Packet)
7d 21 01 Type 1 = Configuration request
7d 21 01 Packet ID = 1 (1st packet sent)
7d 20 00 Length of packet = 0017 hex = 23 including Type.
Note, high byte preceeds low byte
7d 37 17
7d 22 02 Modem Control Characters (ACCM) follow
Length = 6 including ACCM
7d 26 06
7d 20 00
7d 2a 0a
7d 20 00
7d 20 00
7d 25 05 Magic Number (refer to RFC 1662)
Length = 6 including Magic Number
7d 26 06
7d 20 00
7d 27 07 Address & Control Field Compression = ON
Length = 2 including ACF
7d 22 02
7d 28 08Protocol Field Compression = ON (for IP)
Length = 2 including PFC
7d 22 02
7d 2d 0d Data (?)
7d 23 03 Data (?)
7d 26 06 Data (?)
  a5 Frame Check Sequence low byte
high byte
  7e End of HDLC frame
ESC Enc. Data Remarks
Enc. = Encapsuled data byte (+ 20 hex)

Consider all data bytes (bold) in the white fields to determine the FCS for sending a frame. When analyzing the received frame, take all data bytes in the white and red fields. This must result in f0b8 hex for an uncorrupted frame.

Examples for Calculation

Understanding and calculating the checksums is a bit tricky and not always really obvious. However, if you follow «The calculation loop step by step», you can calculate a small frame by hand, using a hex-calculator. I have done so for the «Example HDLC Frame for PPP» and for an example from a correspondent, who did not quite got it right. If you are not yet enlightened, perhaps you try to follow the examples yourself.

  1. Example HDLC Frame for PPP Example 1 (PDF, 1 page, 17 KB).
  2. Some small Example 2 (PDF, 1 page, 14 KB).
  © 2004 - 2018 by Horo Wernli.