How to setup the STM32CubeProgrammer for Arduino?
Here’s a clean, step-by-step way to use STM32CubeProgrammer as the uploader inside Arduino IDE for STM32 (“STM32duino” / ST’s official…
Wiki topics:
📟 · Gadgets & IoT
How to setup the STM32CubeProgrammer for Arduino?
Here’s a clean, step-by-step way to use STM32CubeProgrammer as the uploader inside Arduino IDE for STM32 (“STM32duino” / ST’s official core).

0) What you’ll need
- Arduino IDE 2.x
- **Arduino core for STM32 (Boards Manager name: “STM32 MCU based boards”** by STMicroelectronics)
- STM32CubeProgrammer (includes the CLI tool
STM32_Programmer_CLI) - A supported upload path: DFU (USB), Serial (USART bootloader), or SWD via ST-Link
1) Install the STM32 core in Arduino
- Open Arduino IDE → Boards Manager.
- Search “STM32 MCU based boards” (author: STMicroelectronics) → Install.
- Tools → Board: pick your exact Nucleo/Discovery/Generic STM32 part.
2) Install STM32CubeProgrammer
- Download from ST and install. It places the CLI here (examples):
- Windows:
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe - macOS:
/Applications/STMicroelectronics/STM32CubeProgrammer/STM32CubeProgrammer.app/Contents/MacOS/STM32_Programmer_CLI - Linux:
/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI(varies)
Make the CLI visible to Arduino
Add the bin folder above to your system PATH (or place a symlink to it). Verify from a terminal:
STM32_Programmer_CLI --version
If you see a version number, you’re good.
3) Install drivers (per upload method)
Windows
- Open STM32CubeProgrammer → Help → Install Drivers (this covers ST-Link and USB DFU).
- For DFU, the device should appear as “STM32 BOOTLOADER” or “DFU in FS Mode” in Device Manager.
Linux
- Run ST’s udev rules installer (inside CubeProgrammer’s
Drivers/folder), e.g.:
cd /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/Drivers/rules
sudo ./install.sh
Unplug/replug your board afterward.
macOS
- No extra driver typically needed (both DFU and ST-Link use system frameworks).
4) Pick your upload method in Arduino
Open Tools → Upload method, choose one of:
A) STM32CubeProgrammer (DFU) — native USB bootloader
- Works on boards with native USB (e.g., F4 “Blackpill”, many F7/H7, some G4/L4).
- Put the MCU in DFU mode:
- Many boards: hold BOOT (BOOT0)=1, tap NRST, release → device shows up as DFU.
- Some Arduino cores auto-enter DFU after the first serial upload — depends on board.
- Tools → Port: usually not needed for DFU.
- Upload in Arduino → it calls
STM32_Programmer_CLIunder the hood.
B) STM32CubeProgrammer (Serial) — built-in UART system bootloader
- Connect a USB-UART to the chip’s boot UART (often PA9/PA10 = USART1 on F1/F4; check your MCU).
- BOOT0 = 1, reset to enter system bootloader; after upload set BOOT0 = 0.
- Tools → Port: select your USB-UART COM/tty.
- Upload.
C) STM32CubeProgrammer (SWD) or STLink — via ST-Link/V2
- Connect SWDIO, SWCLK, GND, 3V3 (and NRST if available).
- In Tools → Upload method, pick STM32CubeProgrammer (SWD) (or STLink if offered).
- No BOOT0 gymnastics; this writes flash over SWD directly.
Tip: On Nucleo/Discovery boards, SWD via the on-board ST-Link is the simplest and most reliable.
5) First upload (Blink sanity check)
- File → Examples → 01.Basics → Blink (or STM32 examples under your board).
- Ensure the clock/USB options in Tools match your board (for native USB targets, set USB enabled).
- Upload. You should see CubeProgrammer’s CLI output in the console (DFU/Serial/SWD).
- If Blink runs: done.
6) Troubleshooting quick list
- “STM32_Programmer_CLI not found” → CubeProgrammer not installed or PATH not set. Add its bin to PATH, restart Arduino IDE.
- “No DFU device found” / Upload hangs in DFU → Board not in DFU mode or Windows driver missing. Re-enter DFU (BOOT0+reset) and re-install drivers via CubeProgrammer Help menu.
- Serial upload fails at “No target” → Using wrong UART pins/baud, or not in system bootloader. Check your chip’s boot UART and BOOT0 state.
- ST-Link fails (“No target connected”) → Check SWDIO/SWCLK wiring and 3V3 reference, try lower SWD speed, make sure target isn’t held in reset. → On Linux, confirm udev rules installed; on Windows, install ST-Link driver via CubeProgrammer.
- After Serial/DFU upload it won’t boot user code → Restore BOOT0=0, power-cycle. Also check Option Bytes if you’ve changed them previously.
- Permissions (Linux/macOS)
→ Try
sudo STM32_Programmer_CLI -l usbonce to see device, then fix udev rules (Linux).
7) Power-user: test the link with CLI
Examples you can run in a terminal (not required, but great for debugging):
# List DFU targets
STM32_Programmer_CLI -l usb
# Erase & program via DFU
STM32_Programmer_CLI -c port=usb1 -e all -w /path/to/firmware.bin 0x08000000 -v -rst
# Program via ST-Link (SWD)
STM32_Programmer_CLI -c port=SWD -e all -w firmware.bin 0x08000000 -v -rst
# Program via Serial (USART) at 115200
STM32_Programmer_CLI -c port=COM7 br=115200 parity=none -e all -w firmware.bin 0x08000000 -v -rst
Board-specific notes (common cases)
- Blue Pill (STM32F103C8): no native USB DFU from factory. Use ST-Link (SWD) or Serial; DFU over USB needs a bootloader first.
- Blackpill (STM32F411/F401) & many STM32F4/F7/H7 with native USB: DFU is easiest; ensure USB is enabled in Tools.
- Nucleo/Discovery: prefer SWD via on-board ST-Link; DFU may not be present.
메타데이터
- post_id
- 43f247a630d9
- slug
- how-to-setup-the-stm32cubeprogrammer-for-arduino-43f247a630d9
- url
- https://medium.com/@pqshedy33/how-to-setup-the-stm32cubeprogrammer-for-arduino-43f247a630d9
- canonical_url
- https://medium.com/@pqshedy33/how-to-setup-the-stm32cubeprogrammer-for-arduino-43f247a630d9
- author_url
- https://medium.com/@pqshedy33
- status
- ok
- fetched_at
- 2026-07-15 19:02:01