Coming soon: PowerScope, power-profiling for VS Code
Embedded Development · · 7 min read

Implementing Over-the-Air Device Firmware Update for nRF52 - Part 3

Implementing Over-the-Air Device Firmware Update for nRF52 - Part 3. A step-by-step guide by Novel Bits.

Implementing Over-the-Air Device Firmware Update for nRF52 - Part 3
⚠️
Insider Tip: Start with the free Bluetooth LE Crash Course: twelve short lessons, one a day, covering the fundamentals from the radio up.

Introduction

In the previous post, Implementing Over-the-Air Device Firmware Update for nRF52 - Part 2, we introduced the OTA DFU process on the nRF52.

In this post, we'll go over testing the process using one of the DFU examples included in the nRF5 SDK, the "Bluetooth LE Secure DFU Bootloader" example..

The hardware requirements for running the Bluetooth LE Secure DFU Bootloader example are:

The software requirements are:

Once you’ve got all the hardware and software installed, you’re ready to move on to the next step.

Testing Out OTA DFU on nRF52

Here are the general steps needed to add and perform Secure OTA DFU over Bluetooth LE for your nRF52 project. In our specific case, we'll be testing the BLE Secure DFU Bootloader example.

1 – Generate Private-Public Key Pair

nrfutil keys generate private.key
nrfutil keys display --key pk --format code private.key --out_file public_key.c

These commands will create private-public key pair files. For example:

private.key

-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIJ1fndsl3rf22bc7caRjj4bjm2jc0GZYT4TZqDJvbrIloAoGCCqGSM49
AwEHoUQDQgAE4qdJSqLzn7x9PbwEO5oqkTnRokObRdZyZveQKgUd3GvS0BuJyDU+
Zy1vtGLrn3CaSsPGiJsuwzWmR/pBMQqg/g==
-----END EC PRIVATE KEY-----

public_key.c

/* This file was automatically generated by nrfutil on 2019-11-22 (YY-MM-DD) at 14:51:03 */
 
#include "stdint.h"
#include "compiler_abstraction.h"
 
/** @brief Public key used to verify DFU images */
__ALIGN(4) const uint8_t pk[64] =
{
    0x6b, 0xdc, 0x1d, 0x05, 0x2a, 0x90, 0xf7, 0x66, 0x72, 0xd6, 0x45, 0x9b, 0x43, 0xa2, 0xd1, 0x39, 0x91, 0x2a, 0x9a, 0x3b, 0x04, 0xbc, 0x3d, 0x7d, 0xbc, 0x9f, 0xf3, 0xa2, 0x4a, 0x49, 0xa7, 0xe2, 
    0xfe, 0xa0, 0x0a, 0x31, 0x41, 0xfa, 0x47, 0xa6, 0x35, 0xc3, 0x2e, 0x9b, 0x88, 0xc6, 0xc3, 0x4a, 0x9a, 0x70, 0x9f, 0xeb, 0x62, 0xb4, 0x6f, 0x2d, 0x67, 0x3e, 0x35, 0xc8, 0x89, 0x1b, 0xd0, 0xd2
};

2 – Replace the Placeholder Public Key File

3 – Build the Bluetooth LE Secure DFU Bootloader

Build the Bluetooth LE Secure DFU Bootloader example project (using Segger Embedded Studio).

4 – Flash the Bootloader and the SoftDevice to the nRF52 DK

5 – Verify that Bluetooth LE Secure Bootloader is running

6 – Building the nRF52 Application

7 – Generating the DFU Package

nrfutil pkg generate --hw-version 52 --application-version 1 --application ble_app_blinky_pca10056_s140.hex --sd-req 0xB6 --sd-id 0xB6 --key-file private.key app_dfu_package.zip

8 – Discover and Connect to the DFU Target

9 – Start the DFU Process

10 – New Firmware Application

Once the DFU process is complete, you should see that your new application (that was part of the DFU package) is now running on the DFU Target development kit.
In this example, I used the ble_app_blinky peripheral application:

Next Steps: Buttonless DFU for your Nordic nRF52 project

If you want to take this further and implement Buttonless DFU in your own nRF52 project, I cover it end to end in a full course inside the Bluetooth Developer Academy.

Summary & Closing

In this post, we went over:

💡
Insider Tip: Want the fundamentals underneath all of this? Start with the free Bluetooth LE Crash Course: twelve short lessons, one a day, covering the fundamentals from the radio up.

Read next

Get Started with Bluetooth LE

Download the free Intro to Bluetooth Low Energy eBook, the quickest way to understand the fundamentals.

No spam. Unsubscribe with one click.