something, something marketing. do we need to do this? if you don't know, prepare to know.
this is the firmware repository for RetroPilot's family of automotive gateway and control modules.
they allow users to easily retrofit parts from other cars, selectively gateway ECUs at will, filter and convert messages, control actuators, and more.
Gateway V2 - the CAN gateway of your dreams. gateway messages between buses, retrofit parts, etc.
- gateway and modify CAN messages between multiple buses
- translate signals and convert message formats for part retrofitting
- filter and manipulate specific bits in CAN frames
- enable features by modifying ECU communications
- integrated SSR for connecting and disconnecting busses on-the-fly
Chimera - CAN gateway with raw sensor inputs for complete vehicle integration
- has raw sensor inputs for VSS (vehicle speed), CPS (crank position sensor), and ADC (for cruise control stalks)
- can convert existing CAN messages to RetroPilot format for cars that already have some info available over CAN
- has OBD-C connector on-board for connecting to Comma devices
- has USB port on-board and panda-compatible API for sending/recieving messages over CAN
- ideal for vehicles that need CAN gatewaying and/or direct sensor processing in one device
Actuator Core - motor control for steering, throttle, or brake actuators and other automotive applications
- control two DC motors up to 6A each
- build custom actuators for steering, gas, brakes and more
Relay Core - GPIO and relay control with CAN integration
- control lights, fans, pumps, or other 12V devices via CAN messages or GPIO switches
- build custom lighting controllers that respond to vehicle state
- add remote-controlled accessories to your vehicle
Interceptor Core - analog sensor interception and injection
- intercept gas pedal signals and modify them for drive-by-wire applications
- modify torque sensor signals for custom steering feel
- add safety limits or filtering to analog sensor inputs
hardware is based on STM32F413 (most modules) or STM32F205 (pedal), and is fully OSHW where applicable. board files, bom, and schematics are located in the hardware folder.
firmware borrows heavily from panda, and should be firmware-compatible with Panda firmware as a black panda. conversely, most firmware should also work on a panda, which is helpful for development.
chimera- Chimera gateway firmwareactuator_core- motor controlrelay_core- relay and GPIO controlinterceptor_core- analog sensor interceptionibst- iBooster controlsmart_dsu- smart DSU moduleeps_gw- EPS gatewaysteer_actuator_demo- steering actuator demopanda- panda compatibility modepedal- pedal module (STM32F205)
install Docker for your operating system. then build the container:
./build_container.sh
install pipenv:
pip install pipenv
then setup the environment:
pipenv install
Docker (recommended): enter the environment
pipenv shell
you will want to do this any time you compile firmware, flash, or use the configuration tool. flash the board with
./flash_docker.sh <project name>
where <project_name> is the board or project you want to flash, for example actuator_core for Actuator Core. providing no arguments will list all projects available to build and flash.
enter the pipenv environment:
pipenv shell
then run the configuration tool:
./stm_flash_config.py
select the device you'd like to configure and follow the wizard.
System Config - set device operating mode:
debug_lvl: debug output levelcan_out_en: enable CAN message transmissioniwdg_en: enable watchdog timer (0 while configuring, 1 when finished)mode: operating mode (0=Default/USB control, 1=Steer, 2=Cruise)
TPS Config - throttle position sensor setup (cruise mode only):
adc1: minimum throttle position (fully closed)adc2: maximum throttle position (fully open)adc_tolerance: position control deadzoneadc_num: ADC channel number (0 or 1)
Motor Config - throttle motor setup:
bridge_channel: which H-bridge to use (1 or 2)type: motor function (1=throttle motor)polarity: motor direction (1=normal, 2=inverted)
Clutch Config - clutch motor setup:
bridge_channel: which H-bridge to use (1 or 2)type: motor function (2=clutch)polarity: motor direction (1=normal, 2=inverted)
System Config - set device operating mode:
debug_lvl: debug output levelcan_out_en: enable CAN message transmissioniwdg_en: enable watchdog timer (0 while configuring, 1 when finished)mode: operating mode (0=Unconfigured, 1=Differential, 2=Gas Pedal)override_threshold: differential mode threshold (default 336)
ADC Channel Validation - sensor validation setup:
Differential Mode (center point + tolerance):
adc1: center value (expected sensor position)adc2: unused (set to 0)adc_tolerance: deviation tolerance (±)
Gas Pedal Mode (range limits):
adc1: maximum valid value (e.g., 4000 for 4.0V)adc2: minimum valid value (e.g., 200 for 0.2V)adc_tolerance: hysteresis/noise tolerance
System Config - basic system setup:
debug_lvl: debug output levelcan_out_en: enable CAN message transmissioniwdg_en: enable watchdog timer (0 while configuring, 1 when finished)
Relay Configs - individual relay setup:
label: predefined automotive function (TURN_L_FRONT, HEAD_L, BRAKE_L, etc.)gpio_en: enable GPIO control (0 or 1)gpio_bitmask: GPIO pin combination requiredcan_addr: CAN message ID to monitor (0 disables)can_cmp_val: CAN signal value that triggers relaysig_len/shift_amt: CAN signal extraction parameters
System Config - basic system setup:
debug_lvl: debug output levelcan_out_en: enable CAN message transmissioniwdg_en: enable watchdog timer (0 while configuring, 1 when finished)
CAN Signal Configs - gateway message processing:
can_id: which CAN message to process (hex like 0x123)shift_amt/sig_len: which bits contain your signal (shift right X bits, then mask Y bits)scale_mult/scale_offs: math to convert raw values (result = raw * mult + offset)endian_type: byte order (0=little endian, 1=big endian)is_signed: treat signal as signed integer or notenabled: enable this signal processing (0 or 1)
HALL Sensor Configs - vehicle speed and engine sensor processing:
vss_ppd: pulses per distance (mile or km)is_km: use metric units (1=km, 0=miles)rel_cnt: reluctor tooth count for crank position sensorskipped_teeth: missing teeth count (e.g., 36-1 = 1 skipped tooth)
ADC Button Configs - cruise control button detection:
adc1/adc2: threshold values for button statesadc_tolerance: noise toleranceadc_num: ADC channel for cruise control buttons
use the web-based config tool available here
full documentation and examples are available at the RetroPilot Wiki: