Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Current »

1. Overview

This note describes how to set up and use the Nordic cross-development environment for development and debugging of the Zephyr BSP and a user application running on the Emcraft Thingy-9151-Lite platform.

2. Setting Up Cross Development Host

2.1. Setting Up Hardware Links to Emcraft Thingy-9151-Lite Platform

The emulated hardware platform is used for for early software development, while the Emcraft Thingy-9151-Lite hardware kit is not available yet. The emulated platform is based on the existing nRF9161 and nRF5340 development kits.

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

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.

Setting Up Thingy-9151-Lite Platform

TBD

2.1 Setting Up Software on Cross Development Host

Installing the nRF Connect SDK

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

https://github.com/voxelbotics/sdk-nrf

Set up the nRF Connect SDK on a Linux PC as described in the Nordic documentation for the corresponding version. The instruction for v2.5.1 nRF Connect SDK can be found here:

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.1/nrf/installation/installing.html

Follow the Nordic instructions, but replace the west init... command in step 4 with the one below to use the Emcraft repositories:

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

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

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

https://github.com/voxelbotics/nrf-app

Just clone it in the same directory where west was initialized:

git clone git@github.com:voxelbotics/nrf-app -b main

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

2. Developing Zephyr BSP and Application

2.2. Developing on nRF9151

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

Go to the application directory:

cd nrf-app/thingy9151lite_nrf9151_app/

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

https://github.com/voxelbotics/nrf-app/blob/main/thingy9151lite_nrf9151_app/boards/nrf9161dk_nrf9161_ns.overlay

Build the application for nRF9161 DK using the following command:

west build -b thingy9151lite_nrf9161_ns

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

2.2. Developing on Application Core of nRF5340

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

Go to the application directory:

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:

west build -b thingy9151lite_nrf5340_cpuapp_ns

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

2.2. Developing on Network Core of nRF5340

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

Go to the application directory:

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:

west build -b thingy9151lite_nrf5340_cpunet

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

Using VSCode to build and debug applications

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/.

configure_board_roots1_marked.png

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/ 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 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.

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'

nrfconnect_plugin_openapp.png

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

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

Application

Default board target name

SoC

thingy9151lite_nrf9151_app

thingy9151lite_nrf9161_ns

nRF9161

thingy9151lite_nrf5340_cpuapp_app

thingy9151lite_nrf5340_cpuapp_ns

nRF5340 (application core)

thingy9151lite_nrf5340_cpunet_app

thingy9151lite_nrf5340_cpunet_ns

nRF5340 (network core)

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

nrfconnect_plugin_build.png

Debugging in VSCode

Follow Nordic instructions on debugging in VSCode.

Debug.png

In case manual installation was followed and west complains about missing Python dependencies when trying to install firmware on board, use the following tricks:

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

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

  • start VSCode

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

  • No labels