Three tools to work with a nRF52840 dongle (PCA10059): flash it, push CircuitPython code on it, and build a Zephyr firmware for it.
nrf52840-flasher: DFU flashing over USB, straight to the bulk endpointscircuitpython-ble: push and run code over the serial REPL, plus a BLE peripheral examplezephyr-ble-peripheral: the same BLE peripheral, but compiled
They chain together: flash the dongle, prototype fast in CircuitPython, then move to Zephyr when you need to tune the BLE stack (MTU, intervals, SMP).
pip install pyusb pyserial ecdsaCheck what the dongle is currently running:
bash nrf52840-flasher/check_dongle.shThen flash it. You need a .zip DFU package, not a .hex, and it has to
be a v2 package : this dongle runs the Nordic Open DFU bootloader, which
cannot read the legacy packages adafruit-nrfutil writes. Build one with
Nordic's nrfutil :
nrfutil keys generate priv.pem
nrfutil pkg generate --hw-version 52 --sd-req 0x00 --application app.hex --application-version 1 --key-file priv.pem firmware.zip
sudo python3 nrf52840-flasher/flash_nrf52840.py firmware.zipIf nrfutil misbehaves — installing adafruit-nrfutil next to it overwrites
its command line — nrf52840-flasher/mkpkg_v2.py builds the same package
without going through the CLI.
If you would rather not build a package at all, nRF Connect Programmer
takes the .hex directly and does it for you. Turn Auto read memory off
first, it freezes the bootloader before you get to press Write.
Flashing itself needs no nrfutil, only pyusb. It is the packaging step
that does.
Each folder has its own README. When something goes wrong, read TROUBLESHOOTING.md before anything else.
No firmware binary is shipped here. See FIRMWARES.md for which one to use and where to get it.
Tested on a nRF52840 dongle (PCA10059), on Kali and Debian.
Written by T.I.V while learning Bluetooth Low Energy.
MIT, see LICENSE. One exception: zephyr-ble-peripheral/ is
Apache-2.0, the Zephyr license, like any Zephyr application.