Build & Flash nRF52840

Build CircuitPython

Now we're back to following this guide

Go back to your circuitpython repository. From within ports/nrf build the circuitpython runtime with:

Download: file
make BOARD=pca10056

Upon success you should see that a build-boardname-softdeviceversion/firmware.hex and firmware.uf2 file has been built!

Installing With UF2 (Recommended)

UF2 is a drag-n-drop bootloader system and it's the easiest way to install. Locate the firmware.uf2 file in the build directory. Then drag it onto NRF52BOOT disk drive.

It will disappear and then a new drive will appear named CIRCUITPY - this is the internal circuitpython storage

On the PCA10056, you can re-start the bootloader by holding down Button 1 while clicking the reset button

Uploading with DFU (Harder)

If for some reason you don't want to use UF2, you can also use DFU which is the standard method for programming microcontrollers, it requires special software tho so we recommend UF2

Once the firmware is built as a hex we have to package it up for the bootloader in a zip file.  Do this by running:

Download: file
make BOARD=pca10056 dfu-gen

You should see the creation of a build-boardname-softdeviceversion/dfu-package.zip file

Now all we have to do is upload it. Select the serial port that you find appears when the bootloader is running and put that next to SERIAL=

Download: file
make BOARD=pca10056 SERIAL=/dev/ttyS2 dfu-flash

or if you have a specific zip you want to upload:

Download: file
adafruit-nrfutil --verbose dfu serial --package build-pca10056-s140/dfu-package.zip -p COM3 -b 115200 --singlebank
This guide was first published on Aug 29, 2018. It was last updated on Aug 29, 2018. This page (Build & Flash nRF52840) was last updated on Dec 05, 2019.