Programming onto nRF91 Series devices

You can program applications and samples onto the nRF91 Series devices after Configuring and building an application the corresponding firmware images.

To program firmware onto nRF91 Series devices, follow the process described in the Programming an application section. Pay attention to the exceptions specific to the nRF91 Series, which are listed below.

Before you program a device in the nRF Connect for VS Code extension, you need to set up a build configuration, which is part of Configuring and building an application.

Complete the following steps to program the application:

  1. Connect the development kit to your PC using a USB cable.

  2. Power on the development kit.

  3. Make sure to check the programming exceptions for the nRF91 Series in the sections below.

  4. Open the nRF Connect extension in Visual Studio Code by clicking its icon in the Activity Bar.

  5. In the extension’s Actions View, click on Flash.

For instructions about programming with the nRF Connect for VS Code extension, see How to flash an application.

If you want to program with custom options or scripts, read about Binding custom tasks to actions in the extension documentation.

For information about how to flash and erase in the nRF Connect for VS Code extension, read about the Application-specific flash options.

Compatible versions of modem and application

When you update the application firmware on an nRF91 Series DK, make sure that the modem firmware and application firmware are compatible versions.

Selecting board controller on nRF9160 DK

When programming on the nRF9160 DK, make sure to set the SW10 switch (marked PROG/DEBUG) in the nRF91 position to program the nRF9160 application. In nRF9160 DK board revision v0.9.0 and earlier, the switch is called SW5.

Programming onto Thingy:91

You can also program the Thingy:91 with the images obtained by building the code in an nRF Connect SDK environment.

To set up your system to be able to build a compatible firmware image, follow the Installation guide for the nRF Connect SDK and read the Configuration and building documentation. The build targets of interest for Thingy:91 in nRF Connect SDK are as follows:

Component

Build target

nRF9160 SiP

thingy91/nrf9160/ns

nRF52840 SoC

thingy91/nrf52840

You must use the build target thingy91/nrf9160/ns when building the application code for the nRF9160 SiP and the build target thingy91/nrf52840 when building the application code for the onboard nRF52840 SoC.

Note

  • In nRF Connect SDK releases before v1.3.0, these build targets were named nrf9160_pca20035, nrf9160_pca20035ns, and nrf52840_pca20035.

  • In nRF Connect SDK releases ranging from v1.3.0 to v1.6.1, the build target thingy91/nrf9160/ns was named thingy91_nrf9160ns.

Note

LTE/GNSS features can only be used with Cortex-M Security Extensions enabled (_ns build target).

The table below shows the different types of build files that are generated and the different scenarios in which they are used:

File

File format

Programming scenario

merged.hex

Full image, HEX format

Using an external debug probe and nRF Connect Programmer.

app_signed.hex

MCUboot compatible image, HEX format

Using the built-in bootloader and nRF Connect Programmer.

app_update.bin

MCUboot compatible image, binary format

  • Using the built-in bootloader and mcumgr command line tool.

  • For FOTA updates.

For an overview of different types of build files in the nRF Connect SDK, see Output build files (image files).

There are multiple methods of programming a sample or application onto a Thingy:91. It is recommended to use an external debug probe to program the Thingy:91.

Note

If you do not have an external debug probe available to program the Thingy:91, you can directly program by using the USB (MCUboot) method and nRF Connect Programmer. In this scenario, use the app_signed.hex firmware image file.

Note

While building applications for Thingy:91, the build system changes the signing algorithm of MCUboot so that it uses the default RSA keys. This is to ensure backward compatibility with the MCUboot versions that precede the nRF Connect SDK v1.4.0. Use the default RSA keys only for development. In a final product, you must use your own, secret keys. See Using development keys for more information.

Complete the following steps to program firmware onto Thingy:91:

  1. Set the Thingy:91 SWD selection switch (SW2) to nRF91 or nRF52 depending on whether you want to program the nRF9160 SiP or the nRF52840 SoC component.

  2. Connect the Thingy:91 to the debug out port on a 10-pin external debug probe, for example, nRF9160 DK (Development Kit), using a 10-pin JTAG cable.

    Note

    If you are using nRF9160 DK as the debug probe, make sure that VDD_IO (SW11) is set to 1.8 V on the nRF9160 DK.

  3. Connect the external debug probe to the PC using a USB cable.

  4. Make sure that the Thingy:91 and the external debug probe are powered on.

  1. In nRF Connect for VS Code extension, click the Flash option in the Actions View.

    If you have multiple boards connected, you are prompted to pick a device at the top of the screen.

    A small notification banner appears in the bottom-right corner of Visual Studio Code to display the progress and confirm when the flash is complete.