Adding Nitrogen Board to LAVA Lab

Adding Nitrogen Board to LAVA Lab

This topic documents the steps required for adding Nitrogen board to LAVA lab.

Connect to serial console

On Nitrogen board, serial console is accessible on the low-speed expansion connector, on the PIN5 and PIN7. See https://wiki.seeedstudio.com/BLE_Nitrogen/ for hardware user manual.

Wire end version TTL-232RG USB-serial converter with signal levels 1.8V CMOS can be used for serial connection. e.g. TTL-232RG-VREG1V8-WE.

Refer to the below picture to connect serial wires to Nitrogen low-speed expansion connector.

Serial Wire Nitrogen low-speed Connector
Black: GND Pin1: GND
Yellow: RxD Pin5: UART1_TxD
Orange: TxD Pin7: UART1_RxD

Install pyocd on LAVA worker

PyOCD is an open-source Python program for installing programs into the flash memory of ARM micro controllers. For Nitrogen, pyocd is the default installation tool invoked by west flash.

Run the below commands to install pyocd on LAVA worker.

apt-get install python3 python3-pip python3-testresources libusb-dev libffi-dev 

# Install latest rust for building capstone and cmsis-pack-manager. 
# Required when using raspberry pi4 as LAVA worker.
curl https://sh.rustup.rs -sSf | sh -s -- -y
source ~/.cargo/env

# LAVA uses 'pyocd flash --board' to flash a specific board. '--board' option has been
# removed in pyocd version older then v0.31.0. 
# Issue created on LAVA https://git.lavasoftware.org/lava/lava/-/issues/510
pip3 install pyocd==0.31.0

Add LAVA configurations

Add serial adapter to ser2net.conf

Edit /etc/ser2net.conf to add serial adapter for your board.

Here is an example. Adjust port and serial device ID to adapt your case.

7002:telnet:0:/dev/serial/by-id/usb-FTDI_TTL232RG-VREG1V8_FT3ER4TS-if00-port0:115200 8DATABITS NONE 1STOPBIT LOCAL

Restart ser2net service. Example for systemctl:

systemctl restart ser2net

Add device dictionary to LAVA server

Add device dictionary file /etc/lava-server/dispatcher-config/devices/nitrogen-01.jinja2. Adjust the below example to adapt your case.

{% extends 'nrf52-nitrogen.jinja2' %}
{% set board_id = '9009022103BB5BD6FE653427' %}
{% set device_info = [{'board_id': '9009022103BB5BD6FE653427'}] %}
{% set usb_mass_device = '/dev/disk/by-id/usb-MBED_microcontroller_9009022103BB5BD6FE653427-0:0' %}
{% set pre_power_command = 'ssh root@localhost relay-module.py -c CH3 -s on' %}
{% set pyocd_command = 'pyocd' %}
{% set pyocd_options = ['flash'] %}
{% set pre_os_command = 'pyocd reset --board 9009022103BB5BD6FE653427' %}
{% set connection_list = ['usb0'] %}
{% set connection_tags = {'usb0': ['primary', 'telnet']} %}
{% set connection_command = 'telnet localhost 7002' %}
{% set usb_sleep = 5 %}
{% set sync_to_lava = {'device_type': 'nitrogen', 'worker': 'laptop.chase', 'tags': ['nitrogen-chase-01']} %}

Note: pre_os_command is required to actually boot the flashed ASOS zephyr test images.

If you are adding device to OSTC LAVA instance, send the above device dictionary to LAVA Config. It will be deployed automatic once merged to master branch.

Test your device in LAVA

Submit a LAVA job to test if everything works. LAVA job example LAVA | Scheduler | Jobs | 2129