-
Notifications
You must be signed in to change notification settings - Fork 0
Home
In this tutorial, you’ll explore how you can set up your board farm using Raspberry Pis as Agents and Nordic boards as the device under test. In the first tutorial, multiple test devices were connected to a single runner. This time, each test device gets an agent node. This tutorial shows the upsides of this approach and addresses the challenges that come with it.
Two different variants of the Nordic NRF chip are used to simulate a very real use case where a new revision of a product has been developed, and the firmware needs to be tested on both.
Topics covered:
- Ansible: To commission the Raspberry Pis
- GitHub Actions: To automate the build and test process.
- Self-hosted GitHub runners: Use Raspberry Pis to flash and test.
- GitHub CLI: To check GitHub runners
- Nordic Tools: To compile firmware, find and flash boards
- Bluetooth testing:
- PyTest: Use Python for system tests
- A Linux or macOS-based host machine
- Nodric nRF5340 DK Development Boards
- Nodric nRF5240 DK Development Boards
- Two Raspberry Pis >= 3
- Basic shell experience
- Basic software development experience
To set up your NRF52 board farm, you’ll need the following hardware components:
- Nordic Development Boards:
- 2 Raspberry Pis: Including power supply and micro SD card
- Cables: Sufficient USB cables to connect the Arduino boards.
Connect each development board's USB port to its own dedicated Raspberry Pi. Prepare the Raspberry Pi power supply, but don't yet power on the Pi.
Fork the board_farm_tutorial_2 repository and clone it to your host machine:
gh repo fork bitcrushtesting/board_farm_tutorial_2
gh repo clone board_farm_tutorial_2
cd board_farm_tutorial_2How to install GitHub CLI: GitHub
Execute the start_tutorial.sh shell script. It will purge the files you will create yourself and do some checks on your operating system.
An agent node is a server that executes on behalf of a control node. In this case, GitHub is the control node, and the Raspberry Pis are the agent nodes, each hosting a GitHub runner.
1.0 Flash the operating system
Get the Raspberry Pi Imager application from raspberrypi.com
Install and start the application.
Flash the SD-Card with Raspberry Pi OS (other) -> Raspberry Pi OS Lite (64-bit)
- Edit settings
- Set hostname: 'agent-node-'
- Enable SSH
- Configure wireless LAN
Replace <NUM> with the iteration number, e.g., 1 & 2.
Eject the SD card and insert it into the Raspberry Pi.
1.1 Ansible Inventory
./scripts/ TODO1.2 Get GitHub runner token
./scripts/TODO1.3 Install Dependencies
ansible TODODefine the workflow name:
---
name: NRF52 CI
Define the workflow trigger:
on:
push:
branches:
- main
Define the GitHub-hosted runner:
jobs:
build:
runs-on: ubuntu-latest
Build Job
The steps for this job:
- Get the source code
- Install Python
- Install dependencies
- Install compiler
- Install Nordic SDK
- Build the Heart Rate example
- Upload the binary
Download the source code:
steps:
- name: Checkout code
uses: actions/checkout@v4
Install Python 3.11:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
This installs a tool to download, unpack, and build:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y make wget tar
The SDK requires a specific compiler version. These steps install GCC:
- name: Download and install gcc-arm-none-eabi-7-2018-q2-update
run: |
wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2
tar -xjf gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2
sudo mv gcc-arm-none-eabi-7-2018-q2-update /usr/local/
Download and unpack the Nordic SDK:
- name: Download Nordic SDK
run: |
wget -q https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v17.x.x/nRF5_SDK_17.0.2_d674dde.zip
unzip nRF5_SDK_17.0.2_d674dde.zip -d $GITHUB_WORKSPACE
Build the Heart Rate example that comes with the Nordic SDK:
- name: Build Heart Rate Example
run: |
cd $GITHUB_WORKSPACE/nRF5_SDK_17.0.2_d674dde/examples/ble_peripheral/ble_app_hrs/pca10040/s132/armgcc
make OUTPUT_DIRECTORY=$GITHUB_WORKSPACE/_build
Upload the firmware binary:
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ble_app_hrs_pca10040_s132
path: ${{ github.workspace }}/_build/nrf52832_xxaa.hex
if-no-files-found: error
bleech is a Bluetooth Python library
PyTest is a Python test tool
Test Job
test:
runs-on: self-hosted
needs: build
The test needs to be executed for each board. Similar to the build job, a strategy is defined:
strategy:
matrix:
board:
The steps for this job:
- Get the pre-built binary
- Get the source code
- Flash the board
- Run the test script
Start the next tutorial: Board Farm Tutorial 3
Happy farming!
We would love to hear back from you. Helps us improve our tutorials and file the evaluation form:
If you find this tutorial helpful, please consider ⭐️ring or sharing it! Star this repository
Email: contact@bitcrushtesting.com