back

updated 19 Aug 2025

Arduino for Black Pill

Background

Arduino originally employed microcontrollers lacking USB support.
Arduino now offers a few STM32 modules with integrated USB,
and ST Microelectronics now supports many STM32 chips and boards.

  • Black and Blue Pill modules use the same Arduino board manager.
  • Arduino wants STM32CubeProgrammer for Black Pill DFU;  (installed in D:\my)
    • added to path
    • DFU failed in Arduino 2
      Selected interface: dfu
            -------------------------------------------------------------------
                             STM32CubeProgrammer v2.6.0                  
            -------------------------------------------------------------------
      
      Warning: Wrong connect parameter:
      This was floating A10 issue;
      soldering pins later to the board and jumpering A10 to ground
        enabled DFU by BOOT + RST buttons.

      Trying something slightly different:

      C:\Users\bleke>STM32_Programmer_CLI -l
            -------------------------------------------------------------------
                             STM32CubeProgrammer v2.6.0
            -------------------------------------------------------------------
      
      =====  DFU Interface   =====
      
      No STM32 device in DFU mode connected
      
      ===== STLink Interface =====
      Error: No ST-Link detected!
      .. despite UDBDeview reporting:
      Port_#0002.Hub_#0015 STM32 BOOTLOADER 100 mA USB\VID_0483&PID_DF11\3785389D3030 Removable, UniqueID
      Installing STM32CubeProgrammer v2.20.0 did not discover the Black Pill;
      it does see my ST-Link V2 clone:
      ===== STLink Interface =====
      
      -------- Connected ST-LINK Probes List --------
      
      ST-Link Probe 0 :
         ST-LINK SN  : 49FF72067566515033531081
         ST-LINK FW  : V2J37S7
         Access Port Number  : 0
         Board Name  :
      -----------------------------------------------
      .. so will solder pins to the Black Pill for SWD connection
    • Dupont Wire color coding at ST-Link:
      • GND (6) Black
      • SWDIO (4) Gray
      • SWCLK (2) White
  • Black Pill pinout:
    WeAct STM32F4x1 board pinout

  • 5V tolerant PWM pins are wanted for driving hobby servos or 4-wire PC fans.
  • Unlike Blue Pills, nearly all F401 Black Pill pins are 5V tolerant,
    but not PA0 and PB5 on STM32F411.
  • Other Black (STM32F411) vs Blue (STM32F103) differences
  • Black Pill KEY button pulls PA0 LOW
  • USB-C takes more pins; 14 remaining 5V-tolerant PWM pins:
    PA15,PB3  PB6-9    PB0,1    PB 10  PA6,7    PA1-3
    T2 CH1,2  T4 CH1-4 T3 CH3,4 T2 CH3 T3 CH1,2 T5 CH2-4

T2 and T5 are 32-bit; T3 and T4 are 16-bit; T1 is advanced 16-bit

Two more complementary PWM: PB13,15: T1 CH 1,3

There are at least 4 ways to flash STM32 chips:

  1. DFU (device firmware update) using DfuSe utility or STM32_Programmer_CLI,
    using the STM32 system memory bootloader in ROM,
    using the Black Pill’s DFU bootloader with Arduino
    By default, must force Black Pill into DFU using buttons on board..?
    Reportedly, Arduino use_1200bps_touch jumps STM32 to STM32 ROM DFU bootloader.
    STM32duino Beta enhancement, seemingly already supported for Arduino STM32 modules
    May require a resistor and capacitor
    Caleb Marting's Black Pill DFU video
  2. SWD via ST-LINK
    ST-LINK SWD can be used for any STM32 chip.
  3. (Arduino) USB bootloader[s] <- at least one Arduino Black Pill bootloader exists.
    discussion
    WeAct HID bootloader on Black Pill
  4. STM serial bootloader for use with Arduino

A clone ST-LINK V2 costs no more than a USB COM dongle,
connects to dedicated pins and supports debug.

My clone ST-Link happens to have the correct pinout printed on its cover;
Verify ST-LINK clone pin artwork by sliding that cover partly open (along the USB plug):
ST-LINK pin artwork

STM32duino

Arduino now has an ST Microelectronics-supported core and board manager

Arduino 2 supports debugging, but does not run correctly with RAM Disk installed.
Alternatively, try VSCode-Arduino

Here is the Arduino software page.
Here is the Arduino for STM32 forum. It replaced an earlier one, mostly for Maple/Roger Clark libraries.
Here is the READ-ONLY version of that earlier Arduino for STM32 forum.

STM32F411xC/E Reference manual

Wiring Black Pill to ST-LINK V2 clone: wiring Black Pill to ST-LINK V2 clone
Connect 3.3V from ST-LINK to Black Pill only when Black Pill has no other connections
Put another way, when using ST-LINK to debug Black Pill e.g. plugged to USB,
do NOT connect 3.3V to Black Pill from ST-LINK.

Installing STM32duino support

SimHub bundles an older version of Arduino;  install a portable (ZIP file) Arduino for STM32;
  no need to install Arduino-specific driver[s]...
1) Download, unzip, and run Arduino
  in my case, to E:\my\Arduino\
much of the following is thanks to sgbotic
2) Go to File > Preferences;  add to Additional Board Manager URLs text box: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
3) Go to Tools > Board > Boards Manager;  enter search for STM32:
Boards Manager STM32 search
  click STM32 Cores, then Install (takes quite awhile)
4) Quit and restart Arduino; then
  from Tools > Board: > STM32 Boards, select [Generic STM32F4 series].
  From Tools > Board Part Number:, select [BlackPill F411CE].
  From Tools > Upload method:, select [STM32CubeProgrammer (DFU)].

A simple next step uploads an Arduino blink loop sketch.

Black Pill pin soldering

I use a 40W Weller WLC100 with a fine point, which works well,
  except on ground pins, for which solder does not flow into thru holes,
  presumably being cooled too much by the board's ground plane.
To make solid ground solder joints, pull heated pins partially out, drawing solder into thru holes.

SimHub Custom serial hacking is described here.

maintained by blekenbleu