nRF51 SDK - S110 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Serial (HCI)

Packet Format

Sending a new image application to the nRF51822 is done in three steps:

-First a start packet must be send to the DFU Bootloader.

-Thereafter the binary Application image can be transferred.

-When the complete application image has been transferred, a stop package must be transmitted in order to activate the new image.

Note
After an image has been successfully written to the flash, the DFU Bootloader resets the chip and boots the application. If a new image is desired to be written at a later time, then Button 1 can be pushed during system start-up. This will force the DFU Bootloader into update mode, and a new image can be transferred.

Prepare Application Flash Area

The first packet the DFU Bootloader must receive is the start packet. This packet will inform the DFU Bootloader that the flash must be prepared (erased) and it contains the length of the binary application image. The length of the image is a unsigned 32 bit integer in LSB first order.

If the Heart Rate Example application was to be transfered, the image size is 17,336 bytes, thus the initial packet will become

0xC0 0xC1 0x4E 0x00 0xF1 0x02 0x00 0x00 0x00 0xB8 0x43 0x00 0x00 0xC1 0xA7 0xC0 
0xC0SLIP start/stop
0xC1 0x4E 0x00 0xF1Packet Header
0x02 0x00 0x00 0x00DFU Bootloader Packet field, DFU Bootloader Start Packet.
0xB8 0x43 0x00 0x00DFU Bootloader Application Image Size: 0x000043B8 = 17,336 bytes.
0xC1 0xA7CRC check.
0xC0SLIP start/stop

Figure 2 Shows the example start packet.

hci_start_packet_example.png
Figure 2: Example start packet.
Note
The maximum data packet that can be transfered is 512 bytes + header.
0xC0SLIP start/stop
Packet Header
0x03 0x00 0x00 0x00DFU Bootloader Packet field, DFU Bootloader Application Data Packet.
... Rest of packet ...DFU Bootloader Application Data, 512 bytes.
CRC check.
0xC0SLIP start/stop

Activate Image

When the Application image has been transferred to the DFU Bootloader the image must be activated. The stop packet will inform the DFU Bootloader that transferring of the image has completed and the application can be started.

A stop packet is encoded as:

0xC0SLIP start/stop
Packet Header
0x04 0x00 0x00 0x00DFU Bootloader Packet field, DFU Bootloader Stop Packet.
CRC check.
0xC0SLIP start/stop