STM32F411 Black Pill
Board id: stm32f411-blackpill · 1 step channel · GPIO step output in a 20 kHz timer interrupt · flashed with probe-rs over SWD.
Status
Bring-up has not yet been performed on hardware. This page is the checklist for doing so. Follow it in order and do not skip the no-load steps.
Bill of materials
| Item | Notes |
|---|---|
| WeAct STM32F411CEU6 "Black Pill" | 25 MHz HSE |
| ST-Link V2 or DAPLink probe (SWD) | Required for flashing and recovery with probe-rs |
| Step/dir driver with active-low ENABLE | A4988, DRV8825, or TMC2209 in step/dir mode |
| NEMA 17 stepper | |
| Normally-open limit switch to GND | |
| Hardware E-stop | Must cut motor supply to the driver, independent of the MCU |
| Logic analyser or oscilloscope |
Wiring
The pin map is fixed by the firmware (boards/stm32f4/src/board.rs). The resolver rejects profiles that do not match it.
| Signal | Pin | Notes |
|---|---|---|
| STEP | PA0 | 3.3 V logic — check the driver's VIH |
| DIR | PA1 | |
| EN (active low) | PA2 | 10 kΩ pull-up to driver logic VCC, so reset or a hang means disabled |
| ENDSTOP | PB0 | Switch to GND, internal pull-up |
| USB | PA11 / PA12 | On-board USB-C; the host link (CDC-ACM) |
Profile
The shipped profile is robot-profiles/single-axis-stm32f411.toml. Its axis uses channel 0:
[mcu.main]
board = "stm32f411-blackpill"
transport = "serial:///dev/ttyACM0"
watchdog_ms = 500
[axis.driver]
actuator = "org.motioncore.actuator.step_dir"
step_pin = "PA0"
dir_pin = "PA1"
enable_pin = "PA2"
[axis.endstop]
pin = "PB0"Keep max_velocity × steps_per_unit at or below 20 000 steps/s.
Build and flash
motioncore firmware build --config robot-profiles/single-axis-stm32f411.toml # → build/firmware/main/
motioncore firmware flash --artifact build/firmware/main --yes # probe-rs over SWD
motioncore firmware verify --artifact build/firmware/main --device /dev/ttyACM0motioncore firmware build --board stm32f411-blackpill builds the reference profile into build/firmware/stm32f411-blackpill/ instead. See Firmware: build, flash, verify.
How step timing works
A TIM3 interrupt runs at TICK_HZ = 20 kHz (a 50 µs tick). On each tick the shared stepper code works out which steps have become due and emits each pulse immediately on the GPIO. Consequences:
- Step-edge jitter is bounded by one tick (50 µs).
- STEP high and low times must each be ≥ 2 µs, including back-to-back steps within one tick.
- If the interrupt overruns its 50 µs period, ticks become late. A tick stall longer than the late tolerance during motion faults with
SegmentLateand disables the drive; it never emits a catch-up burst.
Higher step rates would need timer-compare pulse generation instead of tick-based steps.
Bring-up procedure
Board alone.
motioncore firmware build→motioncore firmware flash --yes→motioncore firmware verify. The reported build hash must match the artifact.ENABLE behaviour, driver unpowered. With the analyser: EN high at reset and during flashing; EN low only after
enable.Communication watchdog. Unplug USB while enabled → EN must go high within the watchdog timeout (500 ms).
Firmware hang. Halt the firmware with a debugger → IWDG reset within ~100 ms → EN high.
Step timing. Logic analyser on STEP, DIR and a spare GPIO toggled in the
TIM3interrupt:- STEP high and low time ≥ 2 µs at 1, 5, 10 and 20 kHz, including back-to-back steps in one tick. Compare with the driver datasheet minimums and DIR setup time.
- Jitter of step edges against the commanded rate: bounded by one tick, 50 µs.
- Interrupt execution time at the profile's highest step rate: well below the 50 µs tick period.
- Commanded vs. observed step count for a full move: must match exactly.
- A tick stall longer than the late tolerance during motion must fault with
SegmentLate(drives disabled), not emit a burst.
If any check fails, lower
max_velocityin the profile.Motor connected, no load, low current limit. Jog ±1°, home, stop mid-move, E-stop.
Record the measured limits in
robot-profiles/single-axis-stm32f411.toml.
Performance limits must be measured, not assumed.