Skip to content

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 ​

ItemNotes
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 ENABLEA4988, DRV8825, or TMC2209 in step/dir mode
NEMA 17 stepper
Normally-open limit switch to GND
Hardware E-stopMust 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.

SignalPinNotes
STEPPA03.3 V logic — check the driver's VIH
DIRPA1
EN (active low)PA210 kΩ pull-up to driver logic VCC, so reset or a hang means disabled
ENDSTOPPB0Switch to GND, internal pull-up
USBPA11 / PA12On-board USB-C; the host link (CDC-ACM)

Profile ​

The shipped profile is robot-profiles/single-axis-stm32f411.toml. Its axis uses channel 0:

toml
[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 ​

bash
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/ttyACM0

motioncore 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 SegmentLate and 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 ​

  1. Board alone. motioncore firmware build → motioncore firmware flash --yes → motioncore firmware verify. The reported build hash must match the artifact.

  2. ENABLE behaviour, driver unpowered. With the analyser: EN high at reset and during flashing; EN low only after enable.

  3. Communication watchdog. Unplug USB while enabled → EN must go high within the watchdog timeout (500 ms).

  4. Firmware hang. Halt the firmware with a debugger → IWDG reset within ~100 ms → EN high.

  5. Step timing. Logic analyser on STEP, DIR and a spare GPIO toggled in the TIM3 interrupt:

    • 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_velocity in the profile.

  6. Motor connected, no load, low current limit. Jog ±1°, home, stop mid-move, E-stop.

  7. Record the measured limits in robot-profiles/single-axis-stm32f411.toml.

Performance limits must be measured, not assumed.

Apache-2.0 OR MIT. Not a certified safety system — always use an independent hardware E-stop.