RobohandR1 is an embedded firmware project for the Raspberry Pi Pico 2W (RP2350) microcontroller that provides a robust framework for robotics applications. The system includes a multi-core cooperative/preemptive scheduler, comprehensive statistics collection, hardware diagnostics, and sensor integration.
- Dual-core Scheduler: Supports both cooperative and preemptive multitasking with 5 priority levels, core affinity, and runtime statistics
- USB Shell Interface: Command-line interface for system interaction and debugging with command completion
- Statistics Collection: System-wide performance metrics including CPU usage, memory usage, and task execution timing
- Hardware Diagnostics: Cache and FPU status detection, benchmark capabilities, and optimization suggestions
- IMU Integration: Driver for ICM42670-P 6-axis IMU with DMA support and double buffering for efficient data acquisition
- Raspberry Pi Pico 2W (RP2350)
- ICM42670-P IMU connected via I2C
- USB connection for shell interface
- Ensure you have the Raspberry Pi Pico SDK installed and properly configured
- Configure the CMake build system:
mkdir build cd build cmake .. - Build the project:
make - Flash the firmware to your Raspberry Pi Pico 2W:
make flash
./Include
├── Core # Core system components
│ ├── hardware_stats.h
│ ├── hardware_stats_shell_commands.h
│ ├── mem_usage.h
│ ├── scheduler.h
│ ├── scheduler_shell_commands.h
│ ├── stats.h
│ ├── stats_shell_commands.h
│ └── usb_shell.h
└── Drivers # Hardware device drivers
├── icm42670.h
└── icm42670_shell_commands.h
./Src
├── Core # Core implementations
│ ├── hardware_stats.c
│ ├── hardware_stats_shell_commands.c
│ ├── mem_usage.c
│ ├── scheduler.c
│ ├── scheduler_shell_commands.c
│ ├── stats.c
│ ├── stats_shell_commands.c
│ └── usb_shell.c
├── Drivers # Driver implementations
│ ├── icm42670.c
│ └── icm42670_shell_commands.c
└── main.c # Application entry point
The firmware provides a comprehensive set of shell commands for interacting with the system:
scheduler <start|stop|status>- Control and monitor the schedulertask create <n> <priority> <core> [type]- Create a test taskps- List all tasksstats- Show scheduler statisticstrace <on|off>- Enable/disable scheduler tracing
sys_stats- Show system performance statisticstask_stats- Show task timing statisticsopt [suggest]- Show/suggest optimizationsbuffers- Show registered buffersstatreset <all|tasks>- Reset statistics
hw_stats [status|detail|benchmark|monitor]- View and test cache/FPU functionality
- WIP
- Create a handler function with the signature:
int cmd_handler(int argc, char *argv[]) - Create a
shell_command_tstructure with your command name, help text, and handler - Register the command using
shell_register_command(&your_command)
- Create header (.h) and implementation (.c) files in the appropriate directories
- Follow the driver template pattern in the existing code
- Implement shell commands for interacting with your device
- Register your shell commands during initialization
The system is designed for real-time applications with these optimizations:
- Critical functions placed in RAM for faster execution
- XIP cache enabled for improved flash performance
- FPU enabled for accelerated floating-point calculations
- Multicore task distribution for parallel processing
- This project is licensed under the Apache-2.0 license, which is found in the included LICENSE file.
- Robert Fudge (rnfudge@mun.ca)