npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sw-bluetooth-dfu

v1.1.7

Published

Device firmware update with Web Bluetooth

Downloads

29

Readme

Web Bluetooth DFU

Circle CI Bower npm Licence MIT

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

Versions

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

https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.0.0/lib_dfu_transport_ble.html

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

Features

  • 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:

https://thegecko.github.io/web-bluetooth-dfu/

  • 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)

Prerequisites

Node.js > v8.14.0, which includes npm.

Installation

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:

https://devzone.nordicsemi.com/blogs/1085/getting-started-with-nordics-secure-dfu-bootloader/

tl;dr

J-LINK Interface Firmware

  • Ensure device is running the J-LINK interface firmware available from Nordic

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:

https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v13.0.0/ble_sdk_app_dfu_bootloader.html

e.g.:

$ nrfutil pkg generate --debug-mode --application <your_app.hex> --key-file private.key dfu_app.zip