SolidSense N8 nRF Connect SDK Example

This document gives instructions for using Nordic nRF Connect SDK for programming the 802.15.1 radio on SolidSense N8.

Instructions herein were tested on SolidRun Yocto BSP for i.MX8, Scarthgap release.

Installing nRF Connect SDK

Carefully read the nRF Connect SDK Documentation for installation instructions. At a bare minimum on a Linux host they boil down to the following steps:

  • Install nrfutil cli application

  • Install Toolchain using nrfutil

  • Download SDK Sources using nrfutil

  • Generate CMake Target

install -v -m755 -o root -g root ~/Downloads/nrfutil /usr/local/bin/
nrfutil install sdk-manager
nrfutil sdk-manager toolchain install --ncs-version v2.9.1

nrfutil sdk-manager toolchain launch --ncs-version v2.9.1  --shell
west init -m <https://github.com/nrfconnect/sdk-nrf> --mr v2.9.1 v2.9.1
cd ~/ncs/v2.9.1
west update
west zephyr-export

Enter Development Environment

This step should be repeated when launching a new terminal session:

Define Custom Board

Ultimately defining the SolidSense N8 as a board in Zephyr would be nice but is left as an exercise for the future.

Instead it is possible to reuse the already supported "nrf52833dk" board which is similar enough.

A device-tree overlay should be added to the application process with customer- and SolidRun-specific changes: <app-source>/boards/nrf52833dk_nrf52833.overlay:

Thread CLI Sample

nRF Connect SDK provides a Thread example application with CLI interface on the MCU UART. It can be ported to the SolidSense N8 as follows:

  1. Copy example from nRF Connect SDK:

  1. Add Board configuration:Create a new device-tree overlay at boards/nrf52833dk_nrf52833.overlay with the content described above.

  2. Compile

The resulting application binary is found at build/ot-cli-app/zephyr/zephyr.bin:

Program Application

The generated zephyr.bin file comes without separate bootloader and can be installed at offset 0 to the MCU flash. The programming procedure utilizes SWD interface with OpenOCD.

OpenOCD uses a server-client architecture, it is therefore recommended to operate at least two concurrent terminals to the board, e.g. one UART Console and one SSH, or 2x SSH. Open a third console for interactive debugging to monitor the UART between MCU and Linux.

Take MCU out of reset

The MCU may be kept in reset by GPIO1_IO5 of the Host. Release it:

Start OpenOCD

A suitable configuration file for SolidSense N8 with FWM7BLZ22W MCU is provided below:

The above is included by default in our Yocto BSP at /etc/openocd.cfg, but can be created on the fly as needed.

On the first console start the openocd server:

Program MCU Flash

First the generated zephyr.bin file must be copied to the SolidSense N8 filesystem, e.g. at /root/zephyr.bin.

While openocd is running on the first console, use the second console for connecting with telnet:

Halt the processor, erase flash and program zephyr.bin:

Programming may take a minute without progress indication.

Finally the MCU can be reset to restart execution. It is however recommended to open /dev/ttymsxc3 and monitor the MCU UART before reset:

Open MCU UART Console

This example provides a CLI on the UART that can be accessed from Linux running on the N8:

microcom can be exited pressing ctrl+x.

Note: The MCU may be kept in reset by GPIO1_IO5 of the Host. Release it if needed: gpioset -c /dev/gpiochip0 5=1

Recovery after bad programming

It is possible to get the mcu into a locked state where openocd reports an “unknown” state, see lines 13 following:

Recovery from this state is possible by nrf52_recover command:

Last updated