STM32F103 Programming via USB Port and CubeProgrammer

bootloaderstm32stm32cubemxstm32f103usb

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:

Best Answer

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.