Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This note describes how to set up the emulated hardware platform.

2.1.1. Setting Up Hardware of Emulated Platform

Step through the following procedure in order to set up the emulated platform hardware:

  • Connect a USB Type-C cable to the J6 connector on the nRF9161 DK to the Linux host to get access to the on-board programmer and serial console.

  • Connect a Micro-USB cable to the J2 connector on the nRF5340 DK, and to the Linux host to get access to the on-board programmer and the VCOM based serial consoles.

  • Connect a Micro-USB cable to the J3 connector on the nRF5340 DK, and to the Linux host to get access to the USB based serial consoles.

2.1.2. Setting Up Thingy-9151-Lite Platform

TBD

2.2. 2.1 Setting Up Software on Cross Development Host

2.2.1. Installing the nRF Connect SDK

Emcraft maintains the fork of the nRF Connect SDK on GitHub:

...

Code Block
west init -m https://github.com/voxelbotics/sdk-nrf --mr voxelbotics-v2.5.1-branch

2.2.2. Getting the Source Code of the Thingy-9151-Lite Application

The Thingy-9151-Lite Zephyr application is maintained in the separate GitHub repository:

...

The current branch and release tag are specified in the Release Notes document.

...

3. Developing Zephyr BSP and Application

...

3.

...

1. Developing on nRF9151

3.1.1. Building Thingy-9151-Lite Application for nRF9151/nRF9161 from command line

Go to the application directory:

...

Build the application for nRF9161 DK using the following command:

Code Block
west build -b nrf9161dkthingy9151lite_nrf9161_ns

The resulting image is build/zephyr/merged.hex.

...

3.2. Developing on Application Core of nRF5340

3.2.1. Building Thingy-9151-Lite Application for nRF5340 (application core) from command line

Go to the application directory:

Code Block
cd nrf-app/thingy9151lite_nrf5340_cpuapp_app/

The boards subdirectory contains the configurations of the supported boards. The Nordic nRF5340 DK board is already supported in Zephyr, so it is configured using the devicetree overlay:

https://github.com/voxelbotics/nrf-app/blob/main/thingy9151lite_nrf5340_cpuapp_app/boards/nrf5340dk_nrf5340_cpuapp_ns.overlay

Build the application for nRF5340 DK using the following command:

Code Block
west build -b thingy9151lite_nrf5340_cpuapp_ns

The resulting image is build/zephyr/merged.hex.

3.3. Developing on Network Core of nRF5340

3.3.1. Building Thingy-9151-Lite Application for nRF5340 DK (network core)

Go to the application directory:

Code Block
cd nrf-app/thingy9151lite_nrf5340_cpunet_app/

The boards subdirectory contains the configurations of the supported boards. The Nordic nRF5340 DK board is already supported in Zephyr, so it is configured using the devicetree overlay:

https://github.com/voxelbotics/nrf-app/blob/main/thingy9151lite_nrf5340_cpunet_app/boards/nrf5340dk_nrf5340_cpunet.overlay

Build the application for nRF5340 DK using the following command:

Code Block
west build -b thingy9151lite_nrf5340_cpunet

The resulting image is build/zephyr/zephyr.hex.

4. Using VSCode to build and debug applications

4.1.1. Adding custom boards from the Thingy-9151-Lite

...

into the VSCode

In order for nRF Connect plugin to recognize custom board configurations that come along with nrf-app, add it to the BOARD_ROOT setting of the plugin. For this start VSCode, navigate to File -> Preferences -> Settings -> Extensions -> nRF Connect -> Board Roots, then add the directory where nrf-app repository was cloned:<west_init>/nrf-app/.

...

Sometimes changing BOARD_ROOT is not enough and nRF Connect plugin refuses to show boards from <west_init>/nrf-app/boards as valid configuration targets. To work around this, create fake board skeleton using nRF plugin in the same directory: activate nRF plugin, select 'Create a new board', supply some board name, accept suggested build board name, select any nRF device, specify full path to the <west_init>/nrf-app/boards and finally enter something as company name. After this nRF Connect plugin creates skeleton for the new board in the target path. This board definition will never be used, it is only needed for to force nRF Connect plugin to scan the <west_init>/nrf-app/boards for custom board definitions. This steps should only be needed once per workspace.

4.1.2. Importing the Thingy-9151-Lite Applications into the VSCode

To import the application(s), activate nRF Connect plugin, select ‘Open an existing application', navigate to wanted application (e.g. <west_init>/nrf-app/thingy9151lite_nrf9151_app), press 'Open'

...

It is possible to open several applications into the same workspace.

4.1.3. Building the Thingy-9151-Lite

...

Applications in the VSCode

Start VSCode with workspace where one or more Thingy-9151-Lite Applications are already imported, activate nRF Connect plugin.

If build configuration for the application does not exist yet (no build folder in the ‘Application’ window of nRF Connect plugin), create one by selecting ‘Add build configuration', selecting 'Custom board’ than target board name:

create_build_configuration_marked.png

Select build configuration, use ‘Build' in the 'Actions’ window of the nRF Connect plugin.

nrfconnect_plugin_build.pngImage Removed

...

...

Application

...

Go to the application directory:

Code Block
cd nrf-app/thingy9151lite_nrf5340_cpuapp_app/

The boards subdirectory contains the configurations of the supported boards. The Nordic nRF5340 DK board is already supported in Zephyr, so it is configured using the devicetree overlay:

https://github.com/voxelbotics/nrf-app/blob/main/thingy9151lite_nrf5340_cpuapp_app/boards/nrf5340dk_nrf5340_cpuapp_ns.overlay

Build the application for nRF5340 DK using the following command:

Code Block
west build -b nrf5340dk_nrf5340_cpuapp_ns

The resulting image is build/zephyr/merged.hex.

Importing the Thingy-9151-Lite Application for nRF5340 (application core) into the VSCode

...

Default board target name

SoC

thingy9151lite_nrf9151_app

thingy9151lite_nrf9161_ns

nRF9161

thingy9151lite_nrf5340_cpuapp_app

thingy9151lite_nrf5340_cpuapp_

...

Building the Thingy-9151-Lite Application for nRF5340 (application core) in the VSCode

Start VSCode, activate nRF Connect plugin.

If build configuration for the application does not exist yet (no build folder in the ‘Application’ window of nRF Connect plugin), create one by selecting 'Add build configuration' and accepting defaults.

Select build configuration, use ‘Build' in the 'Actions’ window of the nRF Connect plugin.

2.2. Developing on Network Core of nRF5340

Building Thingy-9151-Lite Application for nRF5340 DK (network core)

Go to the application directory:

...

ns

nRF5340 (application core)

thingy9151lite_nrf5340_cpunet_app

...

The boards subdirectory contains the configurations of the supported boards. The Nordic nRF5340 DK board is already supported in Zephyr, so it is configured using the devicetree overlay:

...

thingy9151lite_nrf5340_cpunet_

...

Build the application for nRF5340 DK using the following command:

Code Block
west build -b nrf5340dk_nrf5340_cpunet

The resulting image is build/zephyr/zephyr.hex.

Importing the Thingy-9151-Lite Application for nRF5340 (network core) into the VSCode

Start VSCode, activate nRF Connect plugin, select ‘Open an existing application', navigate to <west_init>/nrf-app/thingy9151lite_nrf5340_cpunet_app, press 'Open'

Building the Thingy-9151-Lite Application for nRF5340 (network core) in the VSCode

Start VSCode, activate nRF Connect plugin.

...

ns

nRF5340 (network core)

Select build configuration, use ‘Build' in the 'Actions’ window of the nRF Connect plugin.

Debugging Zephyr BSP and Application

nrfconnect_plugin_build.pngImage Added

4.1.4. Debugging in VSCode

Follow Nordic instructions on debugging in VSCode.

...

  • activate Python virtual environment by running <venv dir>\Scripts\activate.bat

  • activate Zephyr environment by running <west_init>\zephyr\zephyr-env.cmd

  • start VSCode with application folder set as current

    Code Block
    > cd nrf-app/thingy9151lite_nrf5340_cpunet_app/
    > code

To make startup easier To avoid repeating this steps create cmd.exe script that will setup environment and launch VSCode and create desktop icon for it.