Go to file
2019-02-22 14:46:16 +07:00
lib update tinyusb to latest for scsi write10 complete fix 2019-02-22 14:46:16 +07:00
src update tinyusb to latest for scsi write10 complete fix 2019-02-22 14:46:16 +07:00
tools Remove language 2018-12-04 16:52:54 -08:00
.gitignore Add build script and hook it into Travis 2018-12-04 15:18:49 -08:00
.gitmodules update tinyusb to latest for scsi write10 complete fix 2019-02-22 14:46:16 +07:00
.travis.yml remove draft since it un-publishes releases 2018-12-06 12:13:06 -08:00
changelog.md added changelog 2019-01-31 22:51:12 +07:00
LICENSE add files from nrf52832 bootloader project 2018-02-07 23:32:49 +07:00
Makefile update segger project, cleanup 2019-01-31 21:39:02 +07:00
README.md readme ref link 2018-12-21 12:48:24 +07:00

Adafruit Bluefruit nRF52 Bootloader

This is a CDC/DFU/UF2 bootloader for nRF52 boards.

UF2 is an easy-to-use bootloader that appears as a flash drive. You can just copy .uf2-format application images to the flash drive to load new firmware. See https://github.com/Microsoft/uf2 and https://github.com/adafruit/uf2-samdx1 for more information.

adafruit-nrfutil, a modified version of Nordic nrfutil, is required to perform DFU. Install python3 if it is not installed already and run this command to install adafruit-nrfutil from PyPi:

$ pip3 install --user adafruit-nrfutil

This repository depends on the following submodules:

Note that tinyusb also includes nrfx as a submodule, so you need to initialize and update submodules with the `--recursive`` flag.

Clone this repo with following commands, or fork it for your own development

git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader
cd Adafruit_nRF52_Bootloader
git submodule update --init --recursive

Features

  • DFU over Serial and OTA ( application, Bootloader+SD )
  • Self-upgradable via Serial and OTA
  • DFU using UF2 (https://github.com/Microsoft/uf2) (application only)
  • Auto-enter DFU briefly on startup for DTR auto-reset trick (832 only)

How to use

There are two pins, DFU and FRST that bootloader will check upon reset/power:

  • Double Reset Reset twice within 500 ms will enter DFU with UF2 and CDC support (only works with nRF52840)
  • DFU = LOW and FRST = HIGH: Enter bootloader with UF2 and CDC support
  • DFU = LOW and FRST = LOW: Enter bootloader with OTA, to upgrade with a mobile application such as Nordic nrfConnect/Toolbox
  • DFU = HIGH and FRST = LOW`: Factory Reset mode: erase firmware application and its data
  • DFU = HIGH and FRST = HIGH`: Go to application code if it is present, otherwise enter DFU with UF2
  • The GPREGRET register can also be set to force the bootloader can enter any of above modes (plus a CDC-only mode for Arduino). GPREGRET is set by the application before performing a soft reset.

On the Nordic PCA10056 DK board, DFU is connected to Button1, and FRST is connected to Button2. So holding down Button1 while clicking RESET will put the board into USB bootloader mode, with UF2 and CDC support. Holding down Button2 while clicking RESET will put the board into OTA (over-the-air) bootloader mode.

On the Nordic PCA10059 Dongle board, DFU is connected to the white button. FRST is connected to pin 1.10. Ground it to pull FRST low, as if you had pushed an FRST button. There is an adjacent ground pad.

For other boards, please check the board definition for details.

Burn & Upgrade with pre-built binaries

You can burn and/or upgrade the bootloader with either a J-link or DFU (serial) to a specific pre-built binary version without the hassle of installing a toolchain and compiling the code. This is preferred if you are not developing/customizing the bootloader. Pre-builtin binaries are available on GitHub releases

Note: The bootloader can be downgraded. Since the binary release is a merged version of of both bootloader and the Nordic SoftDevice, you can freely upgrade/downgrade to any version you like.

How to compile and build

You should only continue if you are looking to develop bootloader for your own. You must have have a J-Link available to "unbrick" your device.

Option 1: Build with Makefile

Prerequisites

To build:

make BOARD=feather_nrf52840_express all combinehex

To flash the bootloader:

make BOARD=feather_nrf52840_express flash

To flash SoftDevice (and chip erase):

make BOARD=feather_nrf52840_express sd

To erase all of flash:

make BOARD=feather_nrf52840_express erase

For the list of supported boards, run make without BOARD= :

$ make
You must provide a BOARD parameter with 'BOARD='
Supported boards are: feather_nrf52840_express feather_nrf52840_express pca10056
Makefile:90: *** BOARD not defined.  Stop

Common makefile problems

1. arm-none-eabi-gcc: No such file or directory

If you get the following error ...

$ make BOARD=feather_nrf52840_express all 
Compiling file: main.c
/bin/sh: /usr/bin/arm-none-eabi-gcc: No such file or directory
make: *** [_build/main.o] Error 127

... you may need to edit the Makefile and update GNU_INSTALL_ROOT to point to the root path of your GCC ARM toolchain.

2. mergehex: No such file or directory

Make sure that mergehex is available from the command-line. This binary is part of Nordic's nRF5x Command Line Tools.

3. make: nrfjprog: No such file or directory

Make sure that nrfjprog is available from the command-line. This binary is part of Nordic's nRF5x Command Line Tools.

On POSIX-type systems you can temporarily add the path to nrfjprog via a variation on the following command:

$ export PATH=$PATH:/location/of/nRF5x-Command-Line-Tools_9_7_2_OSX/nrfjprog

Option 2: Build using Segger Embedded Studio

For easier debugging you can also use SES. The project file is located at src/segger/Adafruit_nRF52_Bootloader.emProject.

Note

: SES only flashes the bootloader when you click download, not the SoftDevice. You need to flash the SoftDevice beforehand if you haven't already done so. As mentioned above do something like:

make BOARD=feather_nrf52840_express sd