7.3.3 PACKET LAYER DEFINITION
Data Packet Structure
Byte
1
2
3
4
5to(4
+ S)
(5 + S)to(4 + S+D)
(5 + S + D)
(6 + S + D)
Description
Header
Packet Count
Serial No. Length S
Data block length D
Serial No.
Data Block
XOR Checksum
Additive Checksum
Byte Value range
128 to 255
0 to 127
1 to 127
1 to 127
32 to 127
0 to 127
0 to 127
0 to 127
Minimum packet size is 8 bytes.
Maximum packet size is 260 bytes.
The same packet structure is used for both transmissions from the master (Command
Packets) and transmissions from the Controller (Reply Packets). A dialogue is always
initiated by a Command Packet from the master.
Header
This byte, which must have bit 7 set (i.e. value between 128 and 255), identifies the
purpose of the packet (a full description of all the different types of packet is given later).
Packet Count
This byte may take a value between 0 and 127, and should be incremented by 1 for each
Command Packet transmitted by the master, except when the packet is a retransmission
due to the fact that no reply was received to the last Command Packet (in which case
the Packet Count should remain at the value of the original Command Packet).
When the Packet Count reaches 127, the Packet Count of the next Command Packet
should be 0. When the Controller replies, the Packet Count byte in the Reply Packet is
set to the same value as in the corresponding Command Packet. This allows the master
to positively associate Reply Packets with Command Packets.
The Controller does perform validation of the Packet Count field in some circumstances.
For example, when transferring a file from the master to a Controller, the file is split
into packets and transmitted one packet at a time. As the Controller receives each packet
it acknowledges this to the master. It is possible, however, that the acknowledgement
is lost (e.g. due to noise), and the master has no way of knowing whether the Controller
ever received that packet or not (as far as the Controller is concerned, the transaction
was completed successfully). In this case, after the time-out period has elapsed (see
below; Packet Timing) when the master re-transmits the Command Packet, the Packet
Count will be the same as in the preceding Command Packet. The Controller, upon
receiving this duplicate packet (which it can identify by the Packet Count) simply
acknowledges the packet, but does not store the data.
Serial Number Length
In Command Packets this is set to the length (in characters) of the serial number of the
Controller to which the packet is intended, hi Reply Packets, this is set to the length (in
characters) of the serial number of the Controller which is transmitting the reply.
52