Flash the STM32
Goal: Build the CrossPad_STM32_r2 firmware and flash it over SWD or USB DFU, or flash a v1 board (PCB r16 / r19).
You need: Start here done, STM32_Programmer_CLI on PATH (the DFU script also finds it through STM32_PROG), Python with pyserial, and an ST-Link for SWD.
The STM32 reads the pads and bridges the ESP console to USB. Flash it when you change its firmware or it stops answering; SWD (step 5) needs an ST-Link, USB DFU (step 6) only the USB cable.
-
Check whether the board already offers the update
The ESP firmware carries an STM32 image and can flash it for you. Open Settings → Programming on the board.
You should see: a
STM32 runningrow with the running version, and below it the bundled version with an Update button (the bundled one is newer) or Reflash (the same version). Press it and wait until the board says it is done. If that works and you are not changing the STM32 firmware, you can stop here.If not: STM32 shows no link in Settings
-
Clone the STM32 firmware (
CrossPad_STM32_r2)This is the STM32 firmware for a v2 board (PCB r20), with its build files and flash scripts.
Terminal window git clone https://github.com/CrossPad/CrossPad_STM32_r2.gitcd CrossPad_STM32_r2You should see:
Cloning into 'CrossPad_STM32_r2'...and no error.If not: STM32 firmware clone fails
-
Put arm-none-eabi-gcc 14.3.x on PATH
The build calls the compiler by its bare name, so it must be on PATH in this terminal. The build is set up for this compiler series, so use exactly this one.
Terminal window export PATH=/path/to/arm-gnu-toolchain-14.3/bin:$PATHarm-none-eabi-gcc --versionTerminal window $env:Path = "C:\path\to\arm-gnu-toolchain-14.3\bin;" + $env:Patharm-none-eabi-gcc --versionYou should see: a first line with a 14.3.x version, followed by a build date.
If not: STM32 build cannot find arm-none-eabi-gcc or stops at flash_guard
-
Build the firmware
The Debug preset builds into
build/Debug, where the flash commands below look forCrossPad_STM32_r20.bin. The last build step checks that the image stays below the NVM page at the top of flash.Terminal window cmake --preset Debugcmake --build build/DebugYou should see: near the end:
-- flash_guard: … B used, … B free below NVM region @0x0801F800If not: STM32 build cannot find arm-none-eabi-gcc or stops at flash_guard
-
Flash over SWD
Connect the ST-Link to the board’s SWD pins and power the board. The command writes the image, resets the STM32 and starts it.
Terminal window STM32_Programmer_CLI -c port=SWD freq=4000 -w build/Debug/CrossPad_STM32_r20.bin 0x08000000 -rst --start 0x08000000You should see:
Start operation achieved successfullyat the end. With-v, alsoDownload verified successfully. -
Flash over USB DFU
No ST-Link needed: with the board in USB serial mode (ESP USB port
303A:3456listed; on the board: Settings → USB → Mode → MIDI + Serial), the script asks the board to enter DFU, flashes it and waits for the app to boot. It writes the first flash page last, so an interrupted flash recovers with a replug and a second run.Terminal window python3 tools/dfu_flash.py --enterTerminal window python tools\dfu_flash.py --enterYou should see:
STM_DFU -> …flashed, app booted (VCP back)If not: STM32 DFU flash fails
-
Flash a v1 board (PCB r16 / r19, repo CrossPad_STM32)
v1 boards use PlatformIO: pick the environment named after the PCB revision,
Crosspad_16orCrosspad_19; the_DFUvariants (Crosspad_16_DFU,Crosspad_19_DFU) flash over USB DFU instead of an ST-Link. Run it from the CrossPad_STM32 folder.Terminal window pio run -e Crosspad_19 -t uploadYou should see: PlatformIO ends with a
[SUCCESS]line.If not: STM32_Programmer_CLI cannot connect over SWD covers the ST-Link side as well.
Check it worked
Section titled “Check it worked”SWD ends with Start operation achieved successfully, DFU with flashed, app booted (VCP back). Then check that the STM32 bridge port 0483:5740 is listed again:
python3 -m serial.tools.list_ports -vpython -m serial.tools.list_ports -vYou should see: a hwid: line with USB VID:PID=0483:5740.
If not: The STM32 bridge port is not listed