Murata Electronics North America XDM2140 Benutzerhandbuch

Seite von 37
 
Example 2: Decoding an HDLC packet received from the XDM2140 
 
To understand how to decode an HDLC packet sent from the XDM2140, let us assume that 
the XDM2140 received a Get command with a parameter of XDM2140 information (see 
Section 9.3.7), and replied with the following HDLC Packet. (All values are in hexadecimal.) 
 
Start Byte 
HDLC Packet Payload (stuffed) 
FCS (stuffed) 
Stop Byte 
7E 
8A 07 00 20 00 00 5B 00 01 01 06 00 3C 00 00 00 00 00 00 7D 5E C3 
02 00 08 30 30 30 5F 45 56 30 31 00 13 00 00 
3E 30 
 
7E 
 
Table 62 
 
Step 1 
(HDLC layer) strip off delimiters: 
 
HDLC Packet Payload (stuffed) 
FCS (stuffed) 
8A 07 00 20 00 00 5B 00 01 01 06 00 3C 00 00 00 00 00 00 7D 5E C3 
02 00 08 30 30 30 5F 45 56 30 31 00 13 00 00 
3E 30 
 
 
Table 63 
 
Step 2 
Remove byte stuffing: 
 
To remove byte stuffing, check for instances of “7D 5D” or “7D 5E” and replace as follows: 
 
7D 5D 
=> 7D 
7D 5E 
=> 7E 
 
HDLC Packet Payload 
FCS 
8A 07 00 20 00 00 5B 00 01 01 06 00 3C 00 00 00 00 00 00 7E C3 02 00 
08 30 30 30 5F 45 56 30 31 00 13 00 00 
3E 30 
 
 
Table 64 
 
Step 3 
Confirm FCS: 
 
Calculate the checksum for the HDLC payload. 
 
HDLC Packet Payload 
8A 07 00 20 00 00 5B 00 01 01 06 00 3C 00 00 00 00 00 00 7E C3 02 00 
08 30 30 30 5F 45 56 30 31 00 13 00 00 
 
Table 65 
 
Confirm that the FCS matches the FCS sent with the packet. Because the packet encodes 
FCS least significant byte first, in this example the calculated FCS should match “30 3E”. 
 
Step 4  (Application layer) parse HDLC payload content: 
 
The resulting packet payload is as follows: 
 
HDLC Packet Payload 
8A 07 00 20 00 00 5B 00 01 01 06 00 3C 00 00 00 00 00 00 7E C3 02 00 
08 30 30 30 5F 45 56 30 31 00 13 00 00 
 
Table 66