USB – Programming STM32F103C Using USB

bootloaderflashstm32usb

What's the Problem?

I created a Custom 'Development/Discovery'-Board and want to program it using USB. I saw in the Datasheet AN2606 that it is not possible to flash the program via USB.

enter image description here

What I tried

A user on this Page told me I need to a flash a Bootloader first using USART1. I wathed multiple videos on this topic and up to a certain point every works. (see following steps)

Working steps:

  1. Connecting the Board to Power Supply and to USART1 (here via micro-USB, using the CP2102N as a USB to UART Bridge)
  2. The device manager detects the UART1-Bridge (see picture) as COMenter image description here
  3. Using the STMFlashLoader to flash the Bootloader (found on GitHub) enter image description here
    also put the Boot0 High, and the Boot1 low. (like mentioned in the Datasheet Pattern1: enter image description here
  4. Getting to the next window (with the traficlight) –> saying Flash size is 64KB.enter image description here
  5. Then choosing the STM32F1_Med-density_64K version of the Target
  6. Still following the tutorials, I choose Download to device and selecting the Download from file the binary-file: generic_boot20_pc13.bin (downloaded from GitHub)
  7. Its staring downloading and it also finished successfully

enter image description here

  1. Then I click on close

Nothing works from here on

I dont know if its on me or if the pc doesnt have all the nessasary tools.
What am I doning next?

  1. Turn the Boot0 back to 0 (low or GND)
  2. Disconnecting the cable i use for setting the Boot1 pin to GND
  3. Then reseting the Board through a Hard reset or via reset button

here is where I relaize something is not working:

  1. Connecting the Board again with the USB cable but on the Power-USB
  2. The LED (in Boot0 = 0 Mode) starts blinking like the pc_13 Bootup should do.
  3. But the USB-Device dont get recognize (see image below) enter image description here

#Does anyone know what I could also do?#

I also tried following:

  • Using the STM32CubeProgrammer
  • Uploading a own Programm (where I activate the possibility for the USB to receive data (working) & sending data (not really sure if working (but should do)).

Maybe someone also had a hard time with this. Hope you can help me!

Best Answer

You seem to have wrong crystal for the bootloader.

You also don't have a pushbutton which the custom bootloader can read to determine if the bootloader should jump to user program or stay in the bootloader and start communicating with USB.