How sabanekko3/smdu_firmware_v2 works
This is STM32F3 embedded motor-control firmware. Its central runtime is the MCU application: timer callbacks invoke motor control and encoder sampling, while the main loop provides ongoing application/debug activity. The user library separates motor actuation, sensing and encoder handling, CAN communication, and motor math. Hardware setup and vendor CMSIS/HAL support are represented as internal layers. Source excerpts are partial and the README is empty, so links not directly evidenced are omitted.
Main entry points: main.cpp Application loop · motor.cpp Motor control · encoder.cpp Encoder handling · Src Peripheral setup
Components 18
Firmware runtime
- Application loop
Core/Src/main.cpp - Board definitions
Core/user_lib/board_data.hpp
Motor control
- Motor control
Core/user_lib/motor.cpp - Motor driver
Core/user_lib/driver.cpp - PWM output
Core/user_lib/pwm.cpp - Motor math
Core/user_lib/motor_math.cpp
Sensing and communication
- Motor measurement
Core/user_lib/motor_measure.cpp - Encoder handling
Core/user_lib/encoder.cpp - Analog sensors
Core/user_lib/analog_sens.cpp - CAN communication
Core/user_lib/can.cpp
MCU platform
- Peripheral setup
Core/Src - Interrupt handlers
Core/Src/stm32f3xx_it.c - CMSIS core and DSP
Drivers/CMSIS/Include - STM32 device access
Drivers/CMSIS/Device/ST/STM32F3xx/Include - STM32 HAL
Drivers/STM32F3xx_HAL_Driver
Other components
- STM32F3 MCU
- Motor and sensors
- CAN bus
Connections 20
- Application loop → Motor control: invokes control
Core/Src/main.cpp - Application loop → Encoder handling: starts sampling
Core/Src/main.cpp - Application loop → Motor measurement: instantiates
Core/Src/main.cpp - Application loop → CAN communication: instantiates
Core/Src/main.cpp - Application loop → PWM output: configures outputs
Core/Src/main.cpp - Motor control → Motor and sensors: actuates
- Encoder handling → Motor and sensors: reads position
- Analog sensors → Motor and sensors: reads signals
- CAN communication → CAN bus: communicates
- Motor control → Motor driver: uses
- Motor control → PWM output: uses
- Motor control → Motor math: uses
- Motor control → Encoder handling: uses
- Application loop → Peripheral setup: initializes
- Interrupt handlers → Peripheral setup: handles events
- Peripheral setup → STM32 HAL: uses
- STM32 HAL → STM32 device access: accesses registers
Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_def.h - Motor math → CMSIS core and DSP: uses DSP
- Application loop → STM32F3 MCU: runs on
- Board definitions → Application loop: defines board data