Difference between revisions of "Serial/HDLC"
(One intermediate revision by the same user not shown) | |||
Line 47: | Line 47: | ||
! 0 | ! 0 | ||
| colspan="8"| HDLC Flag | | colspan="8"| HDLC Flag | ||
− | | colspan="8"| Addr | + | | colspan="8"| Ser_Proto (Addr) |
− | | colspan="8"| Ctrl | + | | colspan="8"| Seq_Num (Ctrl) |
− | | colspan="8"| Protocol | + | | colspan="8"| Dispatch (Protocol) |
|- | |- | ||
! 4 | ! 4 | ||
Line 65: | Line 65: | ||
! ... | ! ... | ||
! ... | ! ... | ||
− | | colspan=" | + | | colspan="8" | CRC<small> (lsb)</small> |
+ | | colspan="8" | CRC<small> (msb)</small> | ||
|- | |- | ||
! ... | ! ... | ||
Line 71: | Line 72: | ||
| colspan="8" | HDLC Flag | | colspan="8" | HDLC Flag | ||
|} | |} | ||
+ | <small>(Based on T2.1.2 source as of 10/24/2012).</small> | ||
Line 78: | Line 80: | ||
; HDLC Flag : (framing) 0x7E, HDLC framing byte. Indicates start of packet. | ; HDLC Flag : (framing) 0x7E, HDLC framing byte. Indicates start of packet. | ||
− | ; Addr | + | ; Ser_Proto (Addr) : HDLC Address byte. Used to indicate low level serial protocol. Only 0x44 (68), SERIAL_PROTO_PACKET_ACK and 0x43 SERIAL_PROTO_ACK are supported. |
− | ; Ctrl | + | ; Seq_Num (Ctrl): HDLC Control byte. Used for sequence number. May or may not be present (see NO_TX_SEQNO). |
− | ; Protocol | + | ; Dispatch (Protocol): HDLC Protocol byte. Used to indicate payload type. |
+ | |||
+ | ; CRC : two byte CRC-16, covers all bytes Ser_Proto through last payload byte. This disagrees with TEP 113 (but is from the source code). Transmitted LSB first. | ||
+ | |||
+ | ; HDLC flag : (framing) 0x7E, closing flag | ||
+ | |||
+ | |||
+ | The bytes 0x7D and 0x7E may not appear inside the packet. 0x7E is framing and 0x7D is escape. 0x7D -> 0x7D 0x5d and 0x7E -> 0x7D 0x5E. | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="text-align:center; width: 400px" border="2" | ||
+ | |+Dispatch (Next Layer Packet Type) | ||
+ | |- | ||
+ | ! Dispatch | ||
+ | ! Protocol type | ||
+ | |- | ||
+ | | 0 || Active Messaging | ||
+ | |- | ||
+ | | 1 || Active Messaging (len16) | ||
+ | |} |
Latest revision as of 02:16, 24 October 2012
Octet | 0 | 1 | 2 | 3 | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Octet | Bit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
0 | 0 | HDLC Flag | Ser_Proto (Addr) | Seq_Num (Ctrl) | Dispatch (Protocol) | ||||||||||||||||||||||||||||
4 | 32 | o o o | |||||||||||||||||||||||||||||||
... | ... | payload | |||||||||||||||||||||||||||||||
... | ... | o o o | |||||||||||||||||||||||||||||||
... | ... | CRC (lsb) | CRC (msb) | ||||||||||||||||||||||||||||||
... | ... | HDLC Flag |
(Based on T2.1.2 source as of 10/24/2012).
See RFC 1662 for more details.
- HDLC Flag
- (framing) 0x7E, HDLC framing byte. Indicates start of packet.
- Ser_Proto (Addr)
- HDLC Address byte. Used to indicate low level serial protocol. Only 0x44 (68), SERIAL_PROTO_PACKET_ACK and 0x43 SERIAL_PROTO_ACK are supported.
- Seq_Num (Ctrl)
- HDLC Control byte. Used for sequence number. May or may not be present (see NO_TX_SEQNO).
- Dispatch (Protocol)
- HDLC Protocol byte. Used to indicate payload type.
- CRC
- two byte CRC-16, covers all bytes Ser_Proto through last payload byte. This disagrees with TEP 113 (but is from the source code). Transmitted LSB first.
- HDLC flag
- (framing) 0x7E, closing flag
The bytes 0x7D and 0x7E may not appear inside the packet. 0x7E is framing and 0x7D is escape. 0x7D -> 0x7D 0x5d and 0x7E -> 0x7D 0x5E.
Dispatch | Protocol type |
---|---|
0 | Active Messaging |
1 | Active Messaging (len16) |