How alkamotors/am32-multirotor-esc-firmware works
AM32 is embedded ESC firmware for STM32-based brushless motor controllers. Its principal workflow is receiving servo PWM or DShot throttle commands, interpreting them in firmware, and driving motor commutation; documented variants add bidirectional DShot, telemetry, sinusoidal startup, and crawler-oriented behavior. The tree also shows MCU-specific peripheral, ADC, comparator, IO, and flash-settings layers. The main-loop excerpt confirms startup and motor-control responsibilities, but omitted source prevents tracing every protocol and peripheral call, so uncertain wiring is left out.
Main entry points: main.c Control loop · dshot.c DShot · peripherals.c Peripheral setup · phaseouts.c Phase outputs
Components 17
Motor control
- Control loop
Src/main.c - Phase outputs
Src/phaseouts.c - Control helpers
Src/functions.c - Startup sounds
Src/sounds.c
MCU hardware
- Target config
Inc/targets.h - Peripheral setup
Mcu/f051/Src/peripherals.c - Pin IO
Mcu/f051/Src/IO.c - ADC sensing
Mcu/f051/Src/ADC.c - Comparator sensing
Mcu/f051/Src/comparator.c
Telemetry and settings
- Flash settings
Mcu/f051/Src/eeprom.c - Serial telemetry
Mcu/f051/Src/serial_telemetry.c - DShot telemetry
Src/dshot.c
Other components
- Flight controller
- ESC and motor
Connections 17
- Flight controller → Servo PWM: sends PWM
- Flight controller → DShot: sends DShot
- Servo PWM → Control loop: provides throttle
- DShot → Control loop: provides throttle
- Control loop → Phase outputs: commutates motor
- Phase outputs → ESC and motor: drives phases
- Control loop → Peripheral setup: initializes
- Control loop → Startup sounds: plays startup tune
- Control loop → Flash settings: loads settings
- Control loop → Serial telemetry: reports telemetry
- DShot → DShot telemetry: supports bidirectional mode
- Target config → Peripheral setup: selects hardware
- Peripheral setup → Pin IO: configures pins
- Control loop → ADC sensing: reads measurements
- Control loop → Comparator sensing: reads phase state
- CRSF → Control loop: supplies serial input
- Control loop → Control helpers: uses control helpers