Skip to content

Programming Healthypi 5 with Zephyr

Healthypi 5 also supports programming using the Zephyr Real-Time Operating System (RTOS). Zephyr is designed for resource-constrained devices and offers a flexible platform for developing applications that require real-time capabilities. Zephyr's versatility allows developers to create more complex applications and take advantage of its real-time features for precise control and responsiveness.

Programming Healthypi 5 with Zephyr RTOS contains of four steps:

  1. Install Zephyr environment and the Zephyr SDK.
  2. Build the Healthypi 5 Zephyr firmware.
  3. Flash the firmware to the Healthypi 5.

Install Zephyr environment and the Zephyr SDK

  1. Update the Update OS and Install dependencies

  2. Install Zephyr and install Python dependencies

  3. Install the Zephyr Software Development Kit SDK which contains toolchains for each of Zephyr’s supported architectures, which include a compiler, assembler, linker and other programs required to build Zephyr applications.

Build the Healthypi 5 Zephyr firmware

  1. Create a workspace and get the zephyr source code inside the workspace.

    west init -m https://github.com/protocentral/protocentral_healthypi5_zephyr --mr main  hpi5-workspace
    

  2. Enter the root directory of the Healthypi 5 Zephyr workspace.

    cd hpi5-workspace
    

  3. Update the workspace's projects based on the contents of the manifest file

    west update
    

  4. Finally building of the fimware. The commands to build the firmware is based on the functionality.

    1. To operate the healthypi with USB streaming, build the firmware app with west build.

      west build -b healthypi5_rp2040 protocentral_healthypi5_zephyr/app
      

    2. To operate the healthypi with USB streaming and BLE support, build the firmware app with west build.

      west build -p auto -b healthypi5_rp2040 protocentral_healthypi5_zephyr/app -DEXTRA_CONF_FILE=overlay-bt.conf
      

    3. To operate the healthypi with USB streaming and Display support, build the firmware app with west build.

      west build -p auto -b healthypi5_rp2040 protocentral_healthypi5_zephyr/app -DEXTRA_CONF_FILE=overlay-display.conf -DEXTRA_DTC_OVERLAY_FILE=healthypi5_rp2040_display.overlay
      

Flash the firmware to the Healthypi 5

Firmware can be flashed to your Healthypi device by either draging and dropping the firmware or by using a Raspberry Pi Debug Probe(not included with the kit, you will need to get one separately).

You may find an explanation of the drag and drop method on the main page. Update your device with the latest firmware with ease using the .uf2 file found in the Healthypi 5 Zephyr workspace in build/zephyr.

To flash using a Raspberry Pi Debug Probe, install OpenOCD using the commands.

  1. Open a command prompt and run the command
    brew install openocd
    
  1. Download openocd for Windows from here: OpenOCD Windows

  2. Copy bin and share dirs to C:\Program Files\OpenOCD\

  3. Add C:\Program Files\OpenOCD\bin to ‘PATH’ environment variable

Connect the Raspberry Pi Debug Probe to the Healthypi in following manner and you are ready to flash your new firmware.

  1. Connect the jumper wire from the UART port of Raspberry Pi Debug Probe to the RP2040 UART connector of Healthypi. The RP2040 UART connector of Healthypi is located below the Spo2 port.

  2. Connect the jumper wire from the Debug port of Raspberry Pi Debug Probe to the RP2040 Debug connector of Healthypi. The RP2040 Debug connector of Healthypi is located below the RP2040 port.

  3. Connect the Raspberry Pi Debug Probe and the computer using a B type cable.

  4. From the command prompt continue,

    west flash
    

debug probe connection