4. Retrieve Application Code

4.1. Code Retrieval sequence

The procedure used by the ROM Booter to retrieve the firmware from the UART is described in Figure 3.

../_images/Firmware_from_UART.jpg

Figure 3 Get Firmware from UART

4.2. Code Retrieval Protocol

The Booter ROM code uses the protocol defined in Table 2. In the protocol the external host should wait to receive the STX byte and then initiate the programming sequence. The length is only two bytes. This limits the size of the bootable image to 64 kBytes.

Table 2 UART Legacy Protocol (64kB)

Byte #

DA14x9x UTX

DA14x9x URX

0

STX = 0x02

1

SOH = 0x01

2

LEN_LSB

3

LEN_MSB

4

ACK = 0x06 or NACK = 0x15

5 .. N

SW code Bytes

N + 1

CRC

N + 2

ACK

If the image is bigger than 64 kBytes and less than 128 kBytes, the protocol described in Table 3 should be used.

Table 3 UART Extended Protocol

Byte #

DA14x9x UTX

DA14x9x URX

0

STX = 0x02

1

SOH = 0x01

2

0x00

3

0x00

4

LEN_LSB

5

LEN_MiddleSB

6

LEN_MSB

7

ACK = 0x06 or NACK = 0x15

8 .. N

SW code Bytes

N + 1

CRC

N + 2

ACK

4.3. Boot time

Since the baudrate of the ROMbooter is fixed to 115200 baud, the bootime can take some time. As an example the time it takes to boot an image of 36kB takes about 3.3 seconds (see Figure 4).

../_images/serial_boot_time.png

Figure 4 Serial Boot Time

An example of a secondary bootloader is uartboot.bin, which is part of the SDK.