User guide

Atmel AVR2054: Serial Bootloader User Guide [APPLICATION NOTE]
8390DWIRELESS03/2015
13
Caution: Setting fuse bits incorrectly may cause improper device functionality.
3.5 Bootloader UART/SPI/TWI programming sequence
The embedded bootloader handles data received over UART/SPI/TWI interfaces using algorithm illustrated on Figure 3-2
and described in steps below.
1. After the device is reset, the embedded bootloader waits 200ms on each enabled interface for a
HANDSHAKE_REQ data sequence to arrive. If no HANDSHAKE_REQ is received on none of the interfaces, the
embedded bootloader jumps to the application’s entry point in the flash memory.
2. If a HANDSHAKE_REQ sequence is received, bootstrap code sends a HANDSHAKE_CONF sequence over the
same serial interface and expects reception of SREC records one by one.
3. After every valid reception of a SREC record the embedded bootloader responds with an ACK data sequence
over the serial interface.
4. In case of any error during loading process, the embedded bootloader sends a NACK data sequence and then
proceeds to step 1.
As the host side, Atmel Bootloader PC tool performs following actions to conform to the embedded bootloader behavior:
1. The Bootloader PC tool sends a HANDSHAKE_REQ data sequence on specified serial port for 30 seconds with
200ms interval, waiting for a
HANDSHAKE_CONF data sequence between transmissions. Any reply except
HANDSHAKE_CONF is ignored.
2. If HANDSHAKE_CONF is received, the PC bootloader starts sending data from the SREC file via the serial link.
Each record of the SREC file is converted to binary representation before sending.
3. For every record sent the host expects an ACK over the serial link as a response. If a NACK sequence is received
or a timeout occurs, the PC bootloader aborts.
Serial data sequences used between the device and the host while boot loading:
HANDSHAKE_REQ: 0xB2 0xA5 0x65 0x4B
HANDSHAKE_CONF: 0x69 0xD3 0x0D 0x26
ACK: 0x4D 0x5A 0x9A 0xB4
NACK: 0x2D 0x59 0x5A 0xB2