Vehicle Control Unit (VCU) firmware for Red Bird Racing. As of current, this codebase is ready for Gen 5 (2025) and Gen 6 (2026).
Overview
This repository contains the embedded firmware for the VCU, responsible for pedal input processing, CAN communication, and vehicle state management. The codebase is modular, with a focus on reliability, maintainability, and real-time performance for electric race vehicles.
Documentation
Key Components
- Pedal: Handles throttle and brake pedal input, producing output torque.
- Telemetry: Produces extra CAN frames for telemetry and debugging.
- Scheduler: Allow tasks to be run at set intervals. A mix of spinlock and yielding ensures accurate timing and maximum speeds.
Getting Started
- Configure Car Constants:
- Edit
BoardConfig.h to choose the correct pin-mappings for a particular board.
- Edit
Pedal.hpp to edit Drivetrain and reverse parameters.
- Configure Pedal Input Constants:
- Edit
Curves.hpp to set appropriate min/max values, as well as the torque curve.
- Build and Flash:
- Use PlatformIO or your preferred toolchain to build and upload the firmware.
- Ensure the vehicle is safely jacked up and powered off during flashing.
- Sensor Calibration:
- Use CAN and the .dbc file to determine the curves for the two APPS, as well as the brakes.
- Adjust configuration (step 2) as needed for reliable and desirable operation.
Debugging
- Enable/disable debug messages by setting flags in
Debug.hpp.
- Debug messages sent as they are produced, and does not have a set interval.
- Debug is centred around showing what Telemetry would show, so there's more focus on tracing the car's states before Telemetry starts communicating, or if the CAN don't work.
- Serial Debugging:
- Connect the VCU to a serial monitor.
- CAN Debugging:
- Connect the VCU's MCP2515 outputs to a USB PCAN.
- Use the provided .dbc to interpret the frames.
- Check the external doc for full references to the messages.
Project Structure
include/ # Header files
lib/ # Modular libraries (Pedal, Signal_Processing, etc.)
src/ # Main application entry point (main.cpp)
scripts/ # Static analysis, formatting, and utility scripts
test/ # Unit and integration tests
Doxyfile # Doxygen configuration
platformio.ini # PlatformIO project config
Current Development
Future Plans
- Continuous maintenance
- No significant development planned / expected.
For questions or contributions, please refer to the documentation links above or contact the Red Bird Racing Software subteam.