Build & Flash Particle

Support for the Particle Argon and Xenon boards featuring the nRF52840 is also being built into CircuitPython. The process at present requires an advanced J-Link programmer and a number of steps, so at present it is not recommended for beginners.

Option 1: Updating the Bootloader with a Segger J-Link and Arduino IDE. 

You can burn the bootloader from within the Arduino IDE using a Segger J-Link. We've detailed these steps on this Learn Guide.

Note: When you're ready to burn the bootloader from the Arduino IDE, make sure the following options are selected:

  • Select `Tools > Board > Adafruit Bluefruit Feather52840 Express`
  • Select `Tools > Programmer > J-Link for Bluefruit nRF52`
  • Select `Tools > Burn Bootloader` with the board and J-Link connected

Option 2: Manually Burning the Bootloader via nrfjprog

The next option is to manually burn the bootloader from the command line using nrfjprog from Nordic. 

Note: These steps will assume you're using a Particle Argon board, however, the Adafruit Bluefruit nRF52 Bootloader can be used with the following Particle boards - Xenon, Boron, and Argon. These boards are supported by CircuitPython 4 Alpha 5 and up. 

The Particle Argon has both the nRF52840 and a ESP32 onboard. Before you can use the ESP32 as a coprocessor in CircuitPython, you'll need to replace the Particle's firmware with CircuitPython.

To cleanup the directory, we'll first run:

make BOARD=particle_argon clean

We'll build the CircuitPython runtime, by running:

make board=particle_argon

The next few commands will use Nordic's nrfjprog tool to burn the bootloader of the Particle Argon with the BlueFruit nRF52-Bootloader.

By burning the Adafruit nRF52-Bootloader on the Particle, you are overwriting the firmware already on your Particle board.

Make sure your Particle is plugged into a debugger, and that both the debugger and the Particle are connected to the PC.

We'll start by erasing all of the flash by running:

make BOARD=particle_argon erase

Then, we'll flash Nordic SoftDevice (and chip erase) by running:

make BOARD=particle_argon sd

Finally, we'll flash the Bluefruit NRF52 bootloader onto the Particle by running: 

make BOARD=particle_argon flash

Installing with UF2

If everything went well, you'll notice a new drive named ARGONBOOT (or XENONBOOT, if you're following along with a Particle Xenon). If you used Option 1 (Installing via Arduino IDE), you'll see a drive called FTHR840BOOT.

Next, and we'll install the CircuitPython firmware for the Particle board you're using. Head to the CircuitPython release page and search for the board you're using. 

Note: Support for the Particle Argon, Xenon, and Boron were first added in CircuitPython 4.0.0 Alpha 5.

Once downloaded, locate the adafruit-circuitpython-particle_argon-X.X.X.uf2 that you just downloaded. Then, drag it onto the ARGONBOOT drive. 

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

Testing the Particle

Since your Particle board is running CircuitPython, you can connect with Mu or your favorite serial port software (like Screen or PuTTY) to the CircuitPython runtime.

If you hit Control-C a few times you'll get this notice of the build version

There's a bright-blue LED built into the Particle and we're going to make it blink. Save the following as on the drive and reload it by typing Control+D into the REPL to see BLUE_LED blink!

Download: file
import time
import board
from digitalio import DigitalInOut, Direction, Pull

led = DigitalInOut(board.BLUE_LED)
led.direction = Direction.OUTPUT

while True:
    led.value = False
    led.value = True

There's an unused MODE button (the reset button is used by CircuitPython to reset the board). We can test that the MODE button works by using it to control the blue LED.

Download: file
# CircuitPython on Particle Demo - GPIO
import time
import board
from digitalio import DigitalInOut, Direction, Pull

led_pin = DigitalInOut(board.BLUE_LED)
led_pin.direction = Direction.OUTPUT
led_pin.value = False

button = DigitalInOut(board.MODE)
button.direction = Direction.INPUT

while True:
    # Check for a button press
    if not button.value:
        print('Button Pressed!')
    led_pin.value = button.value
This guide was first published on Aug 29, 2018. It was last updated on Aug 29, 2018. This page (Build & Flash Particle) was last updated on Apr 22, 2019.