nRF51 SDK - S110 SoftDevice
|
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.
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
0xC0 | SLIP start/stop |
0xC1 0x4E 0x00 0xF1 | Packet Header |
0x02 0x00 0x00 0x00 | DFU Bootloader Packet field, DFU Bootloader Start Packet. |
0xB8 0x43 0x00 0x00 | DFU Bootloader Application Image Size: 0x000043B8 = 17,336 bytes. |
0xC1 0xA7 | CRC check. |
0xC0 | SLIP start/stop |
Figure 2 Shows the example start packet.
0xC0 | SLIP start/stop |
Packet Header | |
0x03 0x00 0x00 0x00 | DFU Bootloader Packet field, DFU Bootloader Application Data Packet. |
... Rest of packet ... | DFU Bootloader Application Data, 512 bytes. |
CRC check. | |
0xC0 | SLIP start/stop |
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:
0xC0 | SLIP start/stop |
Packet Header | |
0x04 0x00 0x00 0x00 | DFU Bootloader Packet field, DFU Bootloader Stop Packet. |
CRC check. | |
0xC0 | SLIP start/stop |