Running Zephyr blinky sample in Raspberry Pi Pico board

In this post, we will run Zephyr’s ‘blinky’ sample on the Pico board. Regarded as the ‘Hello, World!’ for hardware, this simple LED blinking exercise is an invaluable stepping stone in understanding how Zephyr interacts with hardware to perform tasks. Not only does this act as a comprehensive guide to running Zephyr on Raspberry Pi Pico, but it also establishes a sturdy foundation for developing and integrating more complex applications using Zephyr on Pico.

Harness the power of Zephyr on Raspberry Pi Pico with this enlightening walk-through and gear up for an adventurous journey into the versatile world of embedded systems.

For this you will need:
  • Raspberry Pi Pico

1. Install Zephyr and the toolchain

This can be done following instructions on: https://docs.zephyrproject.org/latest/develop/getting_started/index.html

2. Compiling the blinking sample

After following the steps of 1. there will be a Zephyr workspace ready in ~/zephyrproject/ (if you have specified another path please change accordingly) go there and compile a blinky example:

cd ~/zephyrproject/zephyr
west build -b rpi_pico -p always samples/basic/blinky

This will show the build output and finish with:

Memory region         Used Size  Region Size  %age Used
      BOOT_FLASH:         256 B        256 B    100.00%
           FLASH:       11566 B    2096896 B      0.55%
             RAM:        3768 B       264 KB      1.39%
        IDT_LIST:          0 GB         2 KB      0.00%
Converting to uf2, output size: 24064, start address: 0x10000000
Wrote 24064 bytes to zephyr.uf2

3. Flash the program to the Raspberry Pi Pico

The build created a zephyr.uf2 file under build/zephyr/. Now, to program it in the pico board:

  1. Connect the board to the USB port while pressing the BOOTSEL button. This will make a mass storage device appear (like a USB pendrive).
  1. Copy the file zephyr.uf2 inside the folder
  1. The device will unmount and the board will reboot running the blinky sample

Leave a Reply

Your email address will not be published. Required fields are marked *