Firmware for the Raspberry Pi Pico used in the Manafish ROV to control thrusters. It supports two control protocols:
- DShot (digital ESC control)
- PWM (analog ESC control)
All development dependencies are included in the firmware environment on the Manafish Pi, so you can develop directly on the device.
- Raspberry Pi Pico SDK (automatically fetched by CMake)
- clang-format and clang-tidy
- picotool for flashing
- arm-none-eabi-gcc toolchain
- CMake and Make
- picocom for debugging
If you have Nix and direnv installed:
- Enter the directory:
cd microcontroller-firmware - Run
direnv allow
This will automatically download and configure the Pico SDK, ARM toolchain, Clang tools, and CMake.
The project uses CMake to configure the build. The Pico SDK is downloaded automatically on first build.
Run make help to list all available targets.
Key targets include:
make build– Build DShot and PWM firmwaremake flash-dshot– Build and flash DShot firmwaremake flash-pwm– Build and flash PWM firmwaremake clean– Remove build directorymake format– Format source codemake format-check– Verify formatting (useful for CI)make lint– Lint and auto-fix C codemake lint-check– Check C code lint
Compiled .uf2 files appear in:
- build/src/dshot/dshot.uf2
- build/src/pwm/pwm.uf2
Use make flash-dshot or make flash-pwm. Flashing works regardless of whether
the Pico is in BOOTSEL mode—the device reboots automatically as needed.
The firmware outputs debug messages via USB CDC. Use a serial monitor
like picocom to debug:
-
Find the Pico's serial port:
ls /dev/ttyACM* # Linux ls /dev/tty.usbmodem* # Darwin
-
Connect to the device:
# Linux picocom -b 115200 /dev/ttyACM0 # Darwin picocom -b 115200 /dev/tty.usbmodem*
-
Exit with Ctrl+A, then K and confirm.
This project is licensed under the GNU Affero General Public License v3.0 or later - see the LICENSE file for details.