Flash the device

Asset Tracker Template

tags
Asset Tracker Template

Expand the section that matches your hardware setup.

Thingy:91 X (with debugger) or nRF9151 DK

With an external J-Link debugger attached to the Thingy:91 X, flash with:

west flash --erase

The --erase option performs a full chip erase (including UICR) before programming. Without it, west flash fails with a UICR-related error when the new firmware writes different UICR contents.

By default, west flash after a sysbuild programs each bootloader and application image separately. That is equivalent to programming build/merged.hex, which combines the same images into one file. To flash the merged image in a single step (for example after changing partition layout), use:

west flash --erase --skip-rebuild --hex-file build/merged.hex

Release builds publish the same merged image as asset-tracker-template-{VERSION}-<board>-nrf91.hex (see release artifacts).

Thingy:91 X (no debugger)

Thingy:91 X does not have an on-board debugger. Flash over the serial bootloader using one of the following alternatives.

Alternative 1 (recommended) — west thingy91x-dfu: auto-discovers the device and flashes build/dfu_application.zip.

west thingy91x-dfu

Alternative 2 — nrfutil device program: requires the Thingy:91 X serial number. Find it with nrfutil device list by locating the entry with Product: Thingy:91 X UART and the mcuBoot trait:

nrfutil device list
851006699
Product         J-Link
Traits          usb, jlink, seggerUsb

THINGY91X_ED0E7655C09       <-- this is the Thingy:91 X serial number
Product         Thingy:91 X UART
Ports           /dev/tty.usbmodem142102, vcom: 0
                /dev/tty.usbmodem142105, vcom: 1
Traits          mcuBoot, modem, serialPorts, nordicUsb, usb

Then flash, replacing <serial-number> with the identifier from the previous command (for example THINGY91X_ED0E7655C09):

nrfutil device program --firmware build/dfu_application.zip \
    --serial-number <serial-number> --traits mcuboot \
    --x-family nrf91 --core Application

To reset the Thingy:91 X from the terminal without re-flashing (equivalent to pressing the reset button), run:

west thingy91x-reset

The application is now built and flashed to the device. Open a serial terminal at 115200 baud to view the logs. The Serial Terminal app (part of nRF Connect for Desktop) is recommended; PuTTY, Tera Term, and minicom also work.

Next step: Continue to Connecting to claim and provision the device on nRF Cloud.