Developing with Thingy:91
Nordic Thingy:91 is a battery-operated prototyping platform for cellular IoT systems, designed especially for asset tracking applications and environmental monitoring. Thingy:91 integrates an nRF9160 SiP that supports LTE-M, NB-IoT, and Global Navigation Satellite System (GNSS) and an nRF52840 SoC that supports Bluetooth® Low Energy, Near Field Communication (NFC) and USB.
You can find more information on the product in the Thingy:91 product page and in the Nordic Thingy:91 User Guide. The nRF Connect SDK provides support for developing applications on the Thingy:91. If you are not familiar with the nRF Connect SDK and the development environment, see the introductory documentation.
This guide gives you more information on the various aspects of Thingy:91.
Connecting to Thingy:91
You can connect to Thingy:91 wirelessly (using the nRF Toolbox app) or over a serial connection (using LTE Link Monitor, Trace Collector, or a serial terminal).
Using nRF Toolbox
To connect to your Thingy:91 wirelessly, you need to meet the following prerequisites:
The Connectivity bridge installed on your Thingy:91.
The Nordic UART Service (NUS) enabled.
Note
By default, the Bluetooth LE interface is off, as the connection is not encrypted or authenticated. To turn it on at runtime, set the appropriate option in the
Config.txt
file located on the USB Mass storage Device.
Using a serial terminal
If you prefer to use a standard serial terminal, the baud rate has to be specified manually.
Thingy:91 uses the following UART baud rate configuration:
UART Interface |
Baud Rate |
---|---|
UART_0 |
115200 |
UART_1 |
1000000 |
Using LTE Link Monitor
You can use the LTE Link Monitor application to get debug output and send AT commands to the Thingy:91. In the case of LTE Link Monitor or Trace Collector, the baud rate for the communication is set automatically.
To connect to the Thingy:91 using LTE Link Monitor, complete the following steps:
Open nRF Connect for Desktop.
Find LTE Link Monitor in the list of applications and click Install.
Connect the Thingy:91 to a computer with a micro-Universal Serial Bus (USB) cable.
Make sure that the Thingy:91 is powered on.
Launch the LTE Link Monitor application.
In the navigation bar, click SELECT DEVICE. A drop-down menu appears.
In the menu, select Thingy:91.
In the LTE Link Monitor terminal, send an AT command to the modem. If the connection is working, the modem responds with OK.
The terminal view shows all of the Asset Tracker v2 debug output as well as the AT commands and their results. For information on the available AT commands, see nRF91 AT Commands Reference Guide.
Operating modes
Thingy:91 contains RGB indicator LEDs, which indicate the operating state of the device as described in the LED indication section of the User Interface module.
GNSS
Thingy:91 has a GNSS receiver, which, if activated, allows the device to be located globally using GNSS signals. In nRF9160: Asset Tracker v2, GNSS is activated by default.
LTE Band Lock
The modem within Thingy:91 can be configured to use specific LTE bands by using the band lock AT command. See Band lock and the band lock section in the AT Commands reference document for additional information. The preprogrammed firmware configures the modem to use the bands currently certified on the Thingy:91 hardware. When building the firmware, you can configure which bands must be enabled.
LTE-M / NB-IoT switching
Thingy:91 has a multimode modem, which enables it to support automatic switching between LTE-M and NB-IoT. A built-in parameter in the Thingy:91 firmware determines whether the modem first attempts to connect in LTE-M or NB-IoT mode. If the modem fails to connect using this preferred mode within the default timeout period (10 minutes), the modem switches to the other mode.
Building and programming from the source code
You can also program the Thingy:91 by using 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 Getting started guide for nRF Connect SDK. The build targets of interest for Thingy:91 in nRF Connect SDK are as follows:
Component |
Build target |
---|---|
nRF9160 SiP |
|
nRF52840 SoC |
|
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
, andnrf52840_pca20035
.In nRF Connect SDK releases ranging from v1.3.0 to v1.6.1, the build target
thingy91_nrf9160_ns
was namedthingy91_nrf9160ns
.
Note
LTE/GNSS features can only be used with non-secure 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 |
---|---|---|
|
Full image, HEX format |
Using an external debug probe and nRF Connect Programmer. |
|
MCUboot compatible image, HEX format |
Using the built-in bootloader and nRF Connect Programmer. |
|
MCUboot compatible image, binary format |
|
For an overview of different types of build files in the nRF Connect SDK, see Output build 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. The default RSA keys must only be used for development. In a final product, you must use your own, secret keys. See Using development keys for more information.
Building and programming using Visual Studio Code
The nRF Connect for VS Code extension is a complete IDE for developing applications for nRF91, nRF53 and nRF52 Series devices. This includes an interface to the compiler and linker, an RTOS-aware debugger, a seamless interface to the nRF Connect SDK, and a serial terminal. For detailed instructions, see the nRF Connect for Visual Studio Code documentation site.
Complete the following steps after installing the nRF Connect for VS Code extension:
Open Visual Studio Code.
If you installed the nRF Connect SDK using the Installing automatically, you can click the Open VS Code button next to the version you installed.
Complete the steps listed on the Building nRF Connect SDK application quick guide page in the nRF Connect for VS Code extension documentation.
Program the application:
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.
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.
Connect the external debug probe to the PC using a USB cable.
Make sure that the Thingy:91 and the external debug probe are powered on.
In Visual Studio Code, 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.
Building and programming on the command line
Complete the command-line build setup before you start building nRF Connect SDK projects on the command line.
To build and program the source code from the command line, complete the following steps:
Open a terminal window.
Go to the specific sample or application directory. For example, the folder path is
ncs/nrf/applications/asset_tracker_v2
when building the source code for the nRF9160: Asset Tracker v2 application on the nRF9160 SiP component andncs/nrf/applications/connectivity_bridge
when building the source code for the Connectivity bridge application on the nRF52840 SoC component.Make sure that you have the required version of the nRF Connect SDK repository by pulling the nRF Connect SDK repository, sdk-nrf on GitHub using the procedures described in Obtaining a copy of the nRF Connect SDK and Updating a copy of the nRF Connect SDK.
To get the rest of the dependencies, run the
west update
command as follows:west update
To build the sample or application code, run the
west build
command as follows:west build -b build_target
The parameter build_target must be
thingy91_nrf9160_ns
if building for the nRF9160 SiP component andthingy91_nrf52840
if building for the nRF52840 SoC component.Note
The parameter destination_directory_name can be used to optionally specify the destination directory in the west command. Unless a destination_directory_name is specified, the build files are automatically generated in
build/zephyr/
.Program the application:
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.
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.
Connect the external debug probe to the PC using a USB cable.
Make sure that the Thingy:91 and the external debug probe are powered on.
Program the sample or application to the device using the following command:
west flash
The device resets and runs the programmed sample or application.