Adding Arduino Nano 33 BLE Board to LAVA Lab

Adding Arduino Nano 33 BLE Board to LAVA Lab

This topic documents the steps required for adding Arduino Nano 33 BLE board to LAVA lab.

Connect the board to LAVA worker

USB Connection

Connect USB connector of the board to the USB hub that connects to your LAVA worker. The USB hub should support to power on/off/rest its USB ports separately. Hard rest is required to make sure LAVA can always reset the board from soft erase procedure to normal status.

Serial Connection

There are two serial ports on the board. The USB connector is the first one, while the RX0 and TX1 pins are the second one.

As the first serial port will be used for image flashing and hard reset, the second serial port should be used for serial connection in LAVA. With a separate serial connection, the board can be reset without serial interruption. It saves all the potential timing issues of trying to reconnect to the serial line before the app starts.

Connect wires of USB to TTL adapter to the board as shown on the below photo. Please note that do not connect GND pin as it will lead to hard rest failure.

Processing: nano33ble-serial.png…

Serial Wire Arduino Nano 33 BLE
Green: RxD TX1
Red: TxD RX0

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 as needed.

7003:telnet:0:/dev/serial/by-id/usb-FTDI_FT230X_Basic_UART_DA007FUQ-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/arduino-nano-33-ble-01.jinja2. Adjust configs shown in the below example as needed.

{% extends 'arduino-nano-33-ble.jinja2' %}

{% set hard_reset_command = '/root/tools/relay-module.py -c CH1 -s reboot' %}
{% set power_off_command = '/root/tools/relay-module.py -c CH1 -s off' %}
{% set power_on_command = '/root/tools/relay-module.py -c CH1 -s on' %}

{% set flasher_deploy_commands = ['{HARD_RESET_COMMAND}',
                                  'sleep 10',
                                  'stty -F /dev/serial/by-id/usb-Arduino_Nano_33_BLE_84978D71A30C5423-if00 1200',
                                  'sleep 10',
                                  '/root/tools/aarch64/bossac --port=/dev/serial/by-id/usb-Arduino_Arduino_Nano_33_BLE_000000000000000084978D71A30C5423-if00 -d -U -i -e -w {IMAGE}'] %}

{% set connection_command = 'telnet localhost 7003' %}
{% set usb_sleep = 5 %}

{% set sync_to_lava = {'device_type': 'arduino-nano-33-ble', 'worker': 'rpi4.chase', 'tags': ['arduino-nano-33-ble-01']} %}

If you are adding device to OSTC LAVA instance, send the above device dictionary to LAVA Config. It will be deployed automatically 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 | 2692