How ericzhengpig1-png/rm27_training_framework_hw works
This is an educational STM32 C-board firmware framework for learning and building robot-control features. The intended workflow is to initialize board peripherals and ThreadX, acquire BMI088 sensor data, use threads to monitor and share runtime state, and control DJI/M2006 motors over CAN. The README also describes UART/PWM/CAN BSP wrappers, PID/math/CRC libraries, and optional magnetometer or attitude-estimation work. Several implementation details are TODOs; unsampled subsystems are represented only where the README documents their role.
Main entry points: alivethread.cpp IMU and control tasks · DJIMotorHandler.cpp Motor CAN handler · bsp_can.cpp CAN BSP · pid.cpp PID utilities
Components 20
Board runtime
- Startup and peripherals
board/Core/Src/main.c - ThreadX setup
board/Core/Src/app_threadx.c - Generated HAL drivers
board/Core/Src
Peripheral abstraction
Control utilities
- PID utilities
libs/src/pid.cpp - Math and CRC
libs/src/crc.cpp
Robot modules
- IMU data types
modules/include/IMU.hpp - BMI088 driver
modules/src/BMI088.cpp - DJI motor model
modules/include/DJIMotor.hpp - M2006 motor
modules/src/M2006.cpp - Motor CAN handler
modules/src/DJIMotorHandler.cpp - Motor control
modules/src/MotorControl.cpp - IST8310 option
modules
ThreadX tasks
- IMU and control tasks
threads/src/alivethread.cpp - Thread data snapshots
threads/include/threads.hpp
Other components
- STM32 board
- IMU sensor
- CAN motors
Connections 25
- STM32 board → Startup and peripherals: starts
board/Core/Src/main.c - Startup and peripherals → Generated HAL drivers: initializes
board/Core/Src/main.c - Startup and peripherals → ThreadX setup: starts
board/Core/Src/main.c - ThreadX setup → IMU and control tasks: creates tasks
- IMU and control tasks → BMI088 driver: reads sensor
threads/src/alivethread.cpp - IMU sensor → BMI088 driver: supplies measurements
- BMI088 driver → IMU data types: produces IMU data
- IMU and control tasks → Thread data snapshots: publishes snapshots
threads/src/alivethread.cpp - IMU and control tasks → CAN BSP: initializes CAN
threads/src/alivethread.cpp - IMU and control tasks → Motor control: initializes control
threads/src/alivethread.cpp - Motor control → PID utilities: uses PID
- Motor control → Motor CAN handler: updates outputs
- Motor CAN handler → DJI motor model: registers and updates
modules/src/DJIMotorHandler.cpp - Motor CAN handler → M2006 motor: handles model
modules/src/DJIMotorHandler.cpp - Motor CAN handler → CAN BSP: transmits CAN
modules/src/DJIMotorHandler.cpp - CAN BSP → CAN motors: sends frames
- BMI088 driver → PWM BSP: uses peripheral
- UART BSP → STM32 board: uses UART
- IMU and control tasks → Motor CAN handler: monitors motor health
threads/src/alivethread.cpp - IST8310 option → IMU and control tasks: optional sensor task
README.md - CAN BSP → UART BSP: layer order
README.md - UART BSP → PID utilities: layer order
README.md - PID utilities → Motor CAN handler: layer order
README.md - Motor CAN handler → IMU and control tasks: layer order
README.md - PID utilities → Math and CRC: shared utilities
README.md