Skip to content

jeandavilarodz/rpi-pico-imu-relay

Repository files navigation

RP2040-FreeRTOS BNO055 Sensor Application

This repo contains my base project for a FreeRTOS application to be ran on the Raspberry Pi RP2040 microcontroller. This was developed using a Adafruit Feather RP2040.

The application connects using the default I2C interface to a BNO055 sensor and extracts pitch, yaw, and roll from it and prints it to stdio. Stdio is configured to be over UART using interface UART0 or USB.

Based on the work done by smittytone, details in this blog post.

Project Structure

/RP2040-FreeRTOS
|
|___/app                    // Application source code
|   |___CMakeLists.txt      // Application-level CMake config file
|
|___/config
|   |___FreeRTOSConfig.h    // FreeRTOS project config file
|
|___/FreeRTOS-Kernel        // FreeRTOS kernel files, included as a submodule
|___/pico-sdk               // Raspberry Pi Pico SDK, included as a submodule
|
|___CMakeLists.txt          // Top-level project CMake config file
|___pico_sdk_import.cmake   // Raspberry Pi Pico SDK CMake import script
|___deploy.sh               // Build-and-deploy shell script
|
|___rp2040.code-workspace   // Visual Studio Code workspace
|___rp2040.xcworkspace      // Xcode workspace
|
|___README.md
|___LICENSE.md

Prerequisites

To use the code in this repo, your system must be set up for RP2040 C/C++ development. See this blog post of smittyone for setup details.

Usage

  1. Clone the repo.
  2. Enter the repo.
  3. Install the submodules: git submodule update --init --recursive.
  4. Create the build directory: mkdir build.
  5. Manually build the app: cmake --build build.
  6. Connect your device so it’s ready for file transfer.
  7. Press the BOOTSEL button followed by the RESET button to put the board in bootloading mode. The board should appear as a USB drive.
  8. Copy the file ${PROJECT ROOT}/build/app/rpi-pico-imu.uf2 to the USB device mounted by the bootloading process.
  9. The board should restart and run the application.

Raspberry Pi RP2040 Variants

If your board is a variant of the Raspberry Pi Pico, you need to specify this using the PICO_BOARD cmake flag in step 5 of usage. For example, the Adafruit Feather RP2040:

cmake --build build -DPICO_BOARD=adafruit_feather_rp2040

Debug vs Release

You can switch between build types when you make the cmake call in step 5 of usage. A debug build is made explicit with:

cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug

For a release build, which among various optimisations omits UART debugging code, call:

cmake -S . -B build -D CMAKE_BUILD_TYPE=Release

Follow both of these commands with the usual

cmake --build build

IDEs

Workspace files are included for the Visual Studio Code and Xcode IDEs.

Credits

This work was inspired by work done on Twilio Microvisor FreeRTOS Demo code, but the version of the FreeRTOSConfig.h file included here was derived from work by @yunka2.

Copyright and Licences

Application template gerated from source code © 2023, by Tony Smith and licensed under the terms of the MIT Licence.

FreeRTOS © 2021, Amazon Web Services, Inc. It is also licensed under the terms of the MIT Licence.

The Raspberry Pi Pico SDK is © 2020, Raspberry Pi (Trading) Ltd. It is licensed under the terms of the BSD 3-Clause "New" or "Revised" Licence.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages