I created a custom board with an STM32F103C8T6 microprocessor and Iwant to use the USB to program the board using the STM32CubeProgrammer. I found out thanks to a user on Stack Exchange that it is not possible to make it work for the STM32F103 without a DFU or bootloader (see datasheet).

I tried different ways to make it work, see the following points:

  • Using the STMFlashLoader and a bootloader from GitHub (always recommended by YouTube videos, the boot loader by Rodger Clark)
  • Using the STM42CubeProgrammer and the same bootloader.

For more ways, see Programming STM32F103c using USB.

The Problem

Working 1

I always get to the point, where I can upload a program using the STM32CubeProgrammer over the USART1 connector. After setting the Boot0 pin back to 0 and reseting the board, and then connecting the board back using the power/COM port, the device gets recognised but as an UNKNOWN DEVICE.

Working 2

I also tried to enable the USB. That works a little. When the program got flashed via USART1 (like described above) and reconnected, the COM-Port is listed under the COM-Ports (in windows 11 > Device Manager).

Where I am now?

Currently I try and fail, and not really getting anywhere.

What the problem could be:

  • Wrong bootloader
    Should use the right one! Have the PC13 as an LED output (like the boot loader)
  • Wrong schematic connection
  • Wrong way to use the CubeProgrammer and the uploader (did it like in the tutorials)

Maybe somebody encountered the same or a similar problem and can help me fix this.

See my other questions on this topic for additions:

  • 1
    \$\begingroup\$ So may I again ask under this question, why exactly you think your hardware and bootloader are compatible with each other? \$\endgroup\$
    – Justme
    Commented Apr 11, 2023 at 16:38
  • 1
    \$\begingroup\$ Did you check if your STM chip has a protocol or script that allows it to be programmed over USB? On Atmel chips, I've used BOSSAC and SAMBA to upload firmware to ICs directly over USB. I am unsure if STM has an equivalent script. Furthermore, many STM dev boards I've used have a STLINK embedded onto the board, this might be because direct USB programming is not possible. In that case you will need a USB to Serial cable or an FTDI chip on board. \$\endgroup\$
    – md-raz
    Commented Apr 11, 2023 at 16:39
  • \$\begingroup\$ @Justme, I think so because I use the same chip and mostly same pinouts as the blue pill. The only difference could be that I instead of an 8MHz Oscillator a 16MHz Oscillator is used. \$\endgroup\$
    – Y-E-Quit
    Commented Apr 11, 2023 at 16:46
  • 1
    \$\begingroup\$ @md-raz That was the introduction to the actual question; this MCU does not support USB unless the MCU is programmed with a custom bootloader that does support USB. \$\endgroup\$
    – Justme
    Commented Apr 11, 2023 at 16:48

1 Answer 1


So you answered the reason - It does not work if you have 16 MHz oscillator and the bootloader requires a 8 MHz oscillator.

You also don't have a button to trigger the bootloader to go into USB mode instead of jumping to run the main program, but that depends on if the bootloader requires it or not.

  • \$\begingroup\$ But would the whole bootloader not work then? Because the LED lights up yes, but in a very strange frequency \$\endgroup\$
    – Y-E-Quit
    Commented Apr 11, 2023 at 16:52
  • \$\begingroup\$ @Y-E-Quit The MCU is clocked by the crystal. If you have double the frequency you are supposed to use, everything in the MCU will run at double the speed. So it can't blink the LED at correct frequency, or communicate over USB at correct frequency, and if the frequency is over the rate the MCU will work properly, it won't even work properly. \$\endgroup\$
    – Justme
    Commented Apr 11, 2023 at 16:57
  • \$\begingroup\$ In which file, do I usually have to change the Clock settings? Do you know what I have to look for? \$\endgroup\$
    – Y-E-Quit
    Commented Apr 12, 2023 at 7:38
  • 1
    \$\begingroup\$ It seems the code supports compiling with 16M speed option if given the correct defines, so it is easy, but you need to set up the build environment for compiling it. Other option is for you to change to 8 MHz crystal. But like I said, you need a button pin to trigger the bootloader to start USB instead of calling application code. And you need to compile the application code to reside at higher address so it does not overwrite your bootloader. \$\endgroup\$
    – Justme
    Commented Apr 12, 2023 at 8:22
  • 1
    \$\begingroup\$ Do you understand what a bootloader does? It starts and if a button is not pushed, it jumps to execute your application program, and if a button was pushed, it stays in the bootloader and commumicates via USB to allow to reflash the application program. Boot0 has used to enter factory bootloader, it has nothing to do with your custom uploaded bootloader. \$\endgroup\$
    – Justme
    Commented Apr 12, 2023 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.