Skip to content
Device firmware update with Web Bluetooth
TypeScript JavaScript Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Web Bluetooth DFU

Circle CI Bower npm Licence MIT

Update device firmware via Nordic's DFU protocols using Web Bluetooth.


Since version 12 of Nordic's SDK, the device firmware update protocol has changed to be made secure. The protocol can be seen here:

Earlier protocols were insecure, so it is recommended to use the secure protocol version in this package.


  • Supports continuation of failed transfers and skipping of any init packet if already valid
  • Supports Buttonless DFU activation
  • Uses ES6 syntax assuming that all JS engines supporting Web Bluetooth are also ES6 compatible
  • Written with TypeScript to promote type safety

Live Example

This repo has a live web example of the secure DFU. Open this site in a Web Bluetooth enabled browser:

  • Supports drag-and-drop or uploading of firmware packages
  • Supports unzipping of the firmware package in-browser
  • Supports multiple firmware images in a single package (softdevice, bootloader, application)


Node.js > v6.15.0, which includes npm.


The package is distributed using npm. To install the package in your project:

$ npm install web-bluetooth-dfu

Device Configuration

You will need a Nordic nRF51822, nRF52832 or nRF52840 development kit running the latest softdevice. Secure DFU supports softdevices from S130.

Softdevices can be found on Nordic's site:

Upon flashing the device will be in bootloader mode and ready to receive a DFU transfer.

Example packages to update can be found in the firmware folder.

Device Development

An excellent article exists with a walkthrough of using the device firmware update here:


Download / Install

Flashing SoftDevice

  • Erase the chip: $ nrfjprog --family NRF52 --eraseall
  • Grab the relevant softdevice from website (links above) or the SDK (components/softdevice/<SoftDevice>/hex)
  • Flash the softdevice: $ nrfjprog --family NRF52 --program <softdevice.hex> --sectorerase --reset

Using Test DFU Bootloader

  • Grab the relevant bootloader from the SDK (examples/dfu/bootloader_secure_ble/<chip>/hex)
  • Flash the bootloader: $ nrfjprog --family NRF52 --program <bootloader.hex> --sectoranduicrerase --reset

Signing Keys

  • Create a signing key: $ nrfutil keys generate private.key
  • Generate the .c file for the key: $ nrfutil keys display --key pk --format code private.key --out_file dfu_public_key.c

Developing an Application

  • Ensure you have a machine with relevant build tools such as gcc, linux is easiest
  • Rebuild the bootloader with your new key (Update the Makefile to use your new key file)
  • Flash the bootloader: $ nrfjprog --family NRF52 --program <bootloader.hex> --sectoranduicrerase --reset
  • Build your application using your new key file

Building DFU Package

Refer to this document:


$ nrfutil pkg generate --debug-mode --application <your_app.hex> --key-file private.key
You can’t perform that action at this time.