Overview of the link layer protocol, Code packet layout – Echelon LonTal Stack User Manual
Page 52
40
Creating a LonTalk Stack Serial MIP Driver
Overview of the Link Layer Protocol
The LonTalk Serial MIP driver communicates with the host processor over the
built-in SCI serial interface hardware of the FT 5000 Echelon Smart Transceiver,
Series 5000 chip, and the PL 3120 Echelon Smart Transceiver. The Serial MIP
driver uses the Serial MIP link-layer protocol (LLP), which is a two-signal serial
protocol with no extra requirements for handshake signals. The Serial MIP LLP
features quick recovery from serial communication errors such as dropped bytes
or corrupted serial frames.
Code Packet Layout
The basic component of the Serial MIP LLP is the code packet, which starts with
an escape code. If an escape code appears in a normal data stream it is followed
by another escape code and interpreted as a single data byte value rather than
the start of the code packet. The following figure illustrates the code packet
layout.
BYTE 0
BYTE 1
BYTE 2
BYTE 3
Escape:
0x7E
Sequence #,
ACK bit,
Type Code
(excludes
0x7E)
Param Data Packet
Checksum
Sequence
[D7-D5]
Ack
[D4]
Type Code
[D3-D0]
The second byte contains a 3-bit sequence number in the sequence bits (D5-D7), a
single ACK bit (D4), and a 4-bit Type Code bits (D0-D3). You cannot form the
escape code by combining a Type Code value with the sequence number (0x0E is
not allowed). As a result, you can create 15 different codes.
The sequence number is cycled through between values ‘1’ and ‘7’, with ‘0’ being
an initialization value. When a code packet is received that has the same
sequence number as the previous code packet received that packet (and any
following data) is rejected (this transfer will be acknowledged if necessary). The
exception is if the sequence number is zero. The zero sequence number may be
used for any idempotent code packet or message.
The third and fourth bytes may contain the escape code value, but they will not
interpreted as escape codes. This may cause minor re-synchronization issues if
this packet is broken; however, it ensures a constant code packet size.