Production firmware is not released yet. These are the two programming
paths proven during bring-up; use them to load development or test images
linked for flash address 0x08000000.
There are two ways in, and both need the main 24–48 V supply connected. USB-C does not power the board.
| Path | Hardware | Use it for |
|---|---|---|
| USB-C DFU (ROM bootloader) | A USB-C cable | Flashing, with no extra hardware |
| SWD | ST-Link V2 (or clone) | Debugging, live register access, flashing |
Tool support
The STM32H5 is newer than some common open-source tools. Tested:
| Tool | Result | Why |
|---|---|---|
dfu-util 0.11 | Works | Talks to the ROM bootloader (USB ID 0483:df11) |
pyOCD + Keil STM32H5xx_DFP 2.3.1 pack | Works | Supports the H5's CPU access port (AP1) |
st-flash 1.7.0 | Fails | No STM32H5 support |
| OpenOCD 0.11 / 0.12 | Fails | Cannot reach the H5 CPU on AP1 |
USB-C DFU
1. Linux: allow access without root
Add a udev rule for the ROM bootloader (and the ST-Link, if you use SWD too), then reload:
sudo tee /etc/udev/rules.d/49-stm32.rules >/dev/null <<'EOF'
# STM32 ROM bootloader (DFU)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0666"
# ST-Link V2
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", MODE="0666"
EOF
sudo udevadm control --reload-rules && sudo udevadm trigger2. Enter DFU mode
- Connect the main supply (24–48 V on CN1 or CN6) and plug in USB-C.
- Silence other boards on the CAN bus: reset them, put them in DFU too, or unplug the CAN cable. While another board is transmitting, this board may not enumerate (the ROM bootloader also listens on CAN and can lock onto it before USB).
- Hold BOOT, tap RESET, release BOOT.
The board enumerates as "STM Device in DFU Mode". Each board reports its own unique serial number, so a script can tell boards apart:
dfu-util -l3. Flash
# -a 0 = internal flash; :leave starts the new image when done
dfu-util -a 0 -s 0x08000000:leave -D firmware.binWith several boards in DFU mode at once, pick one by serial number with
-S <serial>.
In DFU mode the ROM bootloader takes over pins PB13/PB14 (the encoder clock and data lines), so the encoder reads all zeros until the chip resets into your firmware.
SWD with an ST-Link
Wiring
| ST-Link | Board pad |
|---|---|
| SWCLK | SWCLK (CLK) |
| SWDIO | SWDIO (DIO) |
| GND | GND |
| RST | NRST |
| 3.3 V | Not connected |
Do not connect 3V3
The ST-Link cannot supply the board. Wired to 3V3, the chip browns out and
shows up as chip ID 0x0000 with random disconnects. Power the board from
its main input instead.
pyOCD
python3 -m venv ~/pyocd-venv && . ~/pyocd-venv/bin/activate
pip install pyocd
pyocd pack install stm32h503 # installs the Keil STM32H5xx_DFP pack
pyocd list --targets | grep -i h503 # note the exact target name it prints
pyocd list # the ST-Link should appear
pyocd flash -t <target> --base-address 0x08000000 firmware.bin
pyocd gdbserver -t <target> # for debuggingReplace <target> with the STM32H503CB name from the list --targets output.
A correctly wired, powered board reports device ID 0x474. A brand-new board
has blank flash with readout protection off.
If pyOCD reports "Get IDCODE error", the ST-Link itself is usually stuck: unplug and replug it.
Hardware & wiring
Board layout, connector pinouts and mating parts, power and CAN daisy chain, STEP/DIR and limit inputs, encoder magnet, mounting and clearances for CANStepper NEMA 23.
Bring-up status & test results
What works on the CANStepper NEMA 23 prototype, measured position error from 30 to 800 rpm, and the open items before release.