BlogNewsTop News

Getting Started with Zephyr RTOS on Laird Connectivity’s BL652/BL654

By April 29, 2021May 6th, 2021No Comments

Do you know how to bring up Zephyr RTOS on Laird Connectivity’s BL652 and BL654 Bluetooth modules? If not, this tutorial from Zephyr Project member Laird Connectivity will help. You can find the step-by-step guide and the video below. These materials originally ran on the Laird Connectivity website. For more content like this, please visit their resource page.

Getting Started with Zephyr on Ubuntu 20.04

This tutorial is based on the Zephyr Getting Started Guide. The only difference is we added an extra step (i.e. see step 5 below) to install the nRF Command Line Tools.

This tutorial will show you how to setup the Zephyr development environment, build the Blinky app and flash the app into the BL65x dev kit.

To watch video tutorial, click here.

  1. Update the OS
sudo apt update
sudo apt upgrade
  1. Install Dependencies and verify CMake version.
    sudo apt install --no-install-recommends git cmake ninja-build gperf \
         ccache dfu-util device-tree-compiler wget \
         python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \
         make gcc gcc-multilib g++-multilib libsdl2-dev
         
    cmake --version
    

    If CMake version is not 3.13.1 or later, please visit Zephyr Getting Started Guide for steps on how to update CMake.

  2. Get Zephyr and Install Python Dependencies
    • Install west, and make sure ~/.local/bin is on your PATH environment variable
      pip3 install --user -U west
      echo 'export PATH=~/.local/bin:"$PATH"' >> ~/.bashrc
      source ~/.bashrc
      
    • Get Zephyr Source Code
      west init ~/zephyrproject
      cd ~/zephyrproject
      west update
      
    • Export Zephyr CMake package
      west zephyr-export
      
    • Zephyr’s scripts/requirements.txt file declares additional Python dependencies. Install them with pip3
      pip3 install --user -r ~/zephyrproject/zephyr/scripts/requirements.txt
      
  3. Install Toolchain
    • Download the latest SDK installer
      cd ~
      wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.11.3/zephyr-sdk-0.11.3-setup.run
      
    • Run the installer, installing the SDK in ~/zephyr-sdk-0.11.3
      chmod +x zephyr-sdk-0.11.3-setup.run
      ./zephyr-sdk-0.11.3-setup.run -- -d ~/zephyr-sdk-0.11.3
      
    • Install udev rules so we can flash the boards as a regular user
      sudo cp ~/zephyr-sdk-0.11.3/sysroots/x86_64-pokysdk-linux/usr/share/openocd/contrib/60-openocd.rules /etc/udev/rules.d
      sudo udevadm control --reload
      
  4. Install nRF Command Line Tools Pkg
  5. Build Blinky
    • Build for BL652
      cd ~/zephyrproject/zephyr
      west build -p auto -b bl652_dvk samples/basic/blinky
      
    • Build for BL653
      cd ~/zephyrproject/zephyr
      west build -p auto -b bl653_dvk samples/basic/blinky
      
    • Build for BL654
      cd ~/zephyrproject/zephyr
      west build -p auto -b bl654_dvk samples/basic/blinky
      
  6. Flash the build
    • Connect Ubuntu PC to USB2 port of the dev kit
    • Erase and then flash the build
      nrfjprog -e
      west flash
      
  7. Verify LED1 is flashing

 

For more details about Laird Connectivity’s line of Bluetooth 5 modules, please visit: https://www.lairdconnect.com/bluetooth-5-modules