Coder Social home page Coder Social logo

marciopocebon / web-bluetooth-dfu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from makerdiary/web-bluetooth-dfu

0.0 0.0 0.0 2.28 MB

Device firmware update with Web Bluetooth

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

License: MIT License

Shell 1.01% JavaScript 14.60% HTML 0.40% TypeScript 83.99%

web-bluetooth-dfu's Introduction

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:

http://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 > v4.8.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

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:

http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v13.0.0%2Fble_sdk_app_dfu_bootloader.html

e.g.:

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

web-bluetooth-dfu's People

Contributors

beaufortfrancois avatar mjdietzx avatar thegecko avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.