Getting an STM32 Blue Pill(STM32F103C8T6) "running" means configuring it to start executing your program from flash memory. This is usually straightforward, but there are a few key things to check.
The Short Answer: Boot Pin Configuration
The STM32's startup behavior is controlled by the BOOT0 and BOOT1 pins. To run your programmed code, you need the following configuration:
- BOOT0 = 0 (LOW, connected to GND)
- BOOT1 = 0 (LOW, connected to GND) - Note: BOOT1 is often labeled as PB2 on the pinout.
This is the "Normal Boot Mode" or "Main Flash Memory" mode. On power-up or reset, the microcontroller will begin executing the program you've uploaded to its internal flash memory starting at address 0x0800 0000.
Here's a visual of the correct configuration:
text |-----------------------| | STM32F103 | | Blue Pill | | | | [ ] [ ] [ ] [ ] | | [ ] [ ] [ ] [ ] | | [ ] [ ] [ ] [ ] | |-----------------------| | | 3.3V GND | | | | | | | | | | | | | | | | | | | | | BOOT0 | | BOOT1 | | Pin | | Pin | |________| |_______| (Also PB2) CONNECT BOTH TO GND (0) FOR NORMAL RUN MODE Step-by-Step Guide to "Running Mode"
Step 1: Hardware Configuration (Boot Pins)
Locate the Boot Pins: On the Blue Pill, you'll see two small solder jumpers near the top, labeled BOOT0 and BOOT1 (or sometimes just B0 and B1).
Set BOOT0 to 0:
- The BOOT0 jumper should have a header connecting it to the 0 position (which is connected to GND).
- If it's connected to 1 (3.3V), move the jumper to the 0 position.
- Set BOOT1 to 0:
- The BOOT1 jumper should also be connected to the 0 position.
- On many Blue Pills, BOOT1 is shared with the GPIO pin PB2. For normal operation, it just needs to be low (0).
Correct Configuration for Running:
- BOOT0 Jumper: 0 (GND)
- BOOT1 Jumper: 0 (GND)
Step 2: Power and Reset
- Provide power to the Blue Pill via the 5V or 3.3V pins, or through the USB port (if your board has a USB-serial chip installed).
- Press the RESET button (if your board has one). The MCU will now read the boot pins and begin executing your program from flash memory.
Troubleshooting: If Your Program Doesn't Run
If you've uploaded a program but nothing happens, follow this checklist:
1. Double-Check the Boot Pins (Most Common Issue!)
This is the #1 reason a Blue Pill won't run a programmed application.
- Symptom: The board powers on but does nothing, or it only runs the program after pressing reset.
- Solution: Ensure BOOT0 is definitely connected to GND (0). Use a multimeter to check for continuity if you're unsure.
2. Verify the Program was Uploaded Correctly
- Symptom: A blank board (a new Blue Pill) or a board that was previously working but now isn't.
-
Solution:
- Use an ST-Link programmer or a USB-TTL adapter to upload a simple "Blink" test program.
- Confirm the upload process finished without errors in your IDE (STM32CubeIDE, Arduino IDE, etc.).
3. Check the Power Supply
- Symptom: The board behaves erratically or fails to start.
- Solution: Ensure you have a stable 3.3V power supply. The onboard 3.3V regulator is not very robust. Try powering via the 3.3V pin from a stable external source.
4. Inspect the Oscillators
- Symptom: The program uploads but doesn't run, or timing is completely wrong.
-
Solution:
- The Blue Pill requires an external 8MHz crystal for the main clock. Cheaper boards sometimes have faulty or missing crystals.
- Check that the two small metal crystals (usually 8MHz and 32.768kHz) are properly soldered.
How to Re-Program the Blue Pill (Uploading a New Program)
To upload a new program, you often need to put the board into a state where the bootloader is active.
Method 1: Using the Bootloader (via UART)
This is the classic method, requiring a USB-to-TTL Serial adapter (like CP2102 or FTDI).
- Set Boot Pins for Bootloader Mode:
- BOOT0 = 1 (connect to 3.3V)
- BOOT1 = 0 (connect to GND)
Press the RESET button. The board will now run the built-in ROM bootloader and wait for a connection on UART1 (PA9 & PA10).
Connect your USB-to-TTL adapter:
- Adapter TX -> MCU RX (PA10)
- Adapter RX -> MCU TX (PA9)
- Adapter GND -> MCU GND
- Adapter 3.3V can be used to power the board.
Use a tool like STM32CubeProgrammer or the Arduino IDE to upload the new program via the serial port.
CRUCIAL STEP: After uploading, set the BOOT0 jumper back to 0 (GND) and press RESET. The board will now boot into your new program.
Method 2: Using an ST-Link Debugger (Recommended)
This is the most reliable and professional method.
You do NOT need to change the boot pins. The ST-Link forces the MCU into programming mode via the SWD interface.
Connect the ST-Link to the Blue Pill's SWD header:
- ST-Link VCC -> 3.3V (Optional, but provides power)
- ST-Link GND -> GND
- ST-Link SWDIO -> DIO (PA13)
- ST-Link SWCLK -> CLK (PA14)
In your IDE (STM32CubeIDE, Keil, etc.), select "Download" or "Load". The program will be uploaded and verified.
Press the RESET button on the Blue Pill. With BOOT0=0, it will immediately run your new program.
Summary
To put your STM32 Blue Pill in running mode: Ensure BOOT0 is connected to GND (0), and press RESET. If it still doesn't work, the program itself or the clock configuration might be the issue.


Top comments (0)