Datasheet
AVR068
3
2591C-AVR-06/06
The table describes all states, events and conditions for the handling of incoming
data.
Table 4-1. Protocol Layer State Table
Current State Event Condition Action Next State
Read character from
inbuf
Char == ASCII 27 Get Sequence Number
Read character from
inbuf
Char != ASCII 27 Update statistics Start
Start
Total timeout Exit with error
Read character from
inbuf
Received sequence
number == Sent
sequence number
Get Message Size
Read character from
inbuf
Received sequence
number != Sent
sequence number
Update statistics Start
Get Sequence Number
Total timeout Exit with error
Read character from
inbuf
Get Message Size 2
Get Message Size 1
Total timeout Exit with error
Read character from
inbuf
Calculate message size Get Token
Get Message Size 2
Total timeout Exit with error
Read character from
inbuf
Char == ASCII 14 Get Data
Read character from
inbuf
Char != ASCII 14 Update statistics Start
Get Token
Total timeout Exit with error
Read character from
inbuf
Nmb char read ==
MESSAGE_SIZE
Get Checksum
Read character from
inbuf
Nmb char read <
MESSAGE_SIZE
Get Data
Get Data
Total timeout Exit with error
Read character from
inbuf
Checksum OK
Exit successfully and
handle packet
Read character from
inbuf
Checksum NOT OK Update statistics Start
Get Checksum
Total timeout Exit with error
The state machine on the STK500 side, which receives incoming packets from the
PC, is similar apart from that there is no total timeout in the reception.
The total timeout period is from a command is sent to the answer must be completely
received. The total timeout period is 200 ms for the CMD_SIGN_ON command, 5
seconds for the CMD_READ/PROGRAM_FLASH/EEPROM commands, and 1
second for all other commands.