Page 1 of 2

Having problem to make HID bootloaded 2.2

Posted: Sun Aug 02, 2020 11:45 pm
by zapta
Hi all, I am new year and to STM32.

I got a blue pill and a ST Link V2 dongle from amazon and trying to make it to work with Arduino IDE. I was able to program it with a blinky from the arduino IDE using the V2 dongle and was able to see Serial output on the Arduino serial console so that's good. The board has a chinese clone and a proper 1.5K USB R10 pullup resistor to 3.3V.

Now I want to program a bootloader so I can program it from the Arduino IDE via the USB port. I programed the HID 2.2.2 bootloader from here ... r/releases and the programming seem to go through (I am using the ST V2 programming software) but when I connect it to the computer using a USB cable, windows 10 complains with some error message.

Any suggestion? I presume that this bootloader is supposed to work. Should I try another one?


Re: Having problem to make HID bootloaded 2.2

Posted: Mon Aug 03, 2020 12:41 am
by mrburnette
Check out Roger's WiKi: ... Bootloader

Other links:
Available cores

1. The current STM32F1/F4 core files (Leaflabs-based core) for the latest version of ArduinoIDE for clone boards
- The original documentation from Leaflabs ... the Maple commercial project that lasted only a few years
- WiKi resources ... STM32/wiki and ... =Main_Page

2. The current STM32 core files for STM32 based boards (official STM core, HAL based)
- Please address all hardware or core questions for Nucleo boards in this sub-forum:

3. An alternative generic core: *OUTDATED not under active development * edited: 23.08.2018

4. An alternative F4 core for generic F4 boards edited 26.10.2018
Supported features: ... 976#p26166 [edited by stevestrong - 29.10.2018]
Please refer to this post for specifics.

Specific boards

*RobotDyn Black Pill: ... Black_Pill
Blue Pill: ... =Blue_Pill
Red Pill: ... e=Red_Pill
Black Pill: ... Black_Pill
Maple Mini: ... Maple_Mini

Re: Having problem to make HID bootloaded 2.2

Posted: Mon Aug 03, 2020 8:40 am
by stevestrong
The HID bootloader should work, what you see is that the bootloader did jump to application code which is, in this case, corrupted.
You should set BOOT1 pin to 1 with the jumper, press reset, then the bootloader waits for upload command over USB.
Use a blinky sketch with USB serial, so that after you upload your application you should see the (USB) serial COMM port in the device manager.

Re: Having problem to make HID bootloaded 2.2

Posted: Tue Aug 04, 2020 4:12 pm
by zapta
Thanks for the quick responses. This is very helpful. I will give it a try in a few days once I will have again a functioning Blue Pill (I removed the clone MCU and waiting for a ST genuine from Digikey, hopping it will solve the problem). Also having another BP on order.

Any suggestion for a good reading about what BOOT0 and BOOT1 do and how to use them? All I know is that to program the bootloader I need to move BOOT0 to 1 and back.

Re: Having problem to make HID bootloaded 2.2

Posted: Tue Aug 04, 2020 4:36 pm
by mrburnette ... ootloader/

The embedded bootloader on STM32
All the STM32 microcontrollers come with built-in bootloaders that burned in during production. Depending on device type, flash memory can be flashed using one of the interfaces like USART1 or USART2, USB, CAN.

Mostly we are dealing with low, medium, and high-density devices so they can access bootloader using USART1 interface. USART1 can be accessed directly via RS232 interface or USART to USB driver chip like FT232.

To enter the bootloader, a couple of special MCU pins has to be set-up to proper logical values. The pins are named BOOT0 and BOOT1 on STM32 microcontroller. Boot pins can select several modes of bootloader operation:


STM32 microcontroller boot pins configurations
As you can see, there are three cases:

The first case is when BOOT0 pin is tied to ground and BOOT1 is open or at logical state 0 then after reset program is executed from Main Flash Memory. Grounded BOOT pins is a standard configuration when executing programs in the field.
The second case (BOOT1=0; BOOT0=1) means that after reset execution starts at System memory were built into bootloader resides. This is the case when we need to upload binaries via USART1.
The third case means that program execution is performed in SRAM.
Let us focus on the second case – System memory. In most of the development boards, you will find a couple of jumper pins where you can select BOOT0 and BOOT1 configurations. In our case, the STM32F103RBT6 board looks like this:


BOOT0 and BOOT1 on STM32 microcontroller
In the image above, you can see that the jumper setting already selects to run internal bootloader after the restart.

Re: Having problem to make HID bootloaded 2.2

Posted: Wed Aug 05, 2020 10:02 am
by stevestrong
Additionally to Ray's comment: ... /
Normally, both BOOT-0 and BOOT-1 must be connected to '0'. If you connect BOOT-1 pin to 3.3V (or '1' on BluePill boards), the board will stay in HID Bootloader mode.

Re: Having problem to make HID bootloaded 2.2

Posted: Sat Aug 08, 2020 7:19 pm
by Riffer
I had the same issue today and at the end downgrading from 1.9 to 1.8 of the STM32 core helped.

Having that done (cleaned up memory and flashed bootloader once again) I flashed blink with CDC option and now it works as expected.

//Edit: I was able to update core to 1.90. Maybe the root of my problem was solved by installing a driver for STM32 device. My system recognised the pill as a generic serial device that helps Arduino when searching for it.

Re: Having problem to make HID bootloaded 2.2

Posted: Sun Aug 16, 2020 1:47 am
by zapta
Thanks you everybody for the information. This was very useful and I can now program the board from the Arduino IDE using the HID 2.2 bootloader. I do have a couple of followup questions for you.

1. Before I program my blinky program from the Arduino IDE I move BOOT 1 to '1' and press the reset button to enter the bootloader mode (very fast blink). Is this how it should be done? (having to move the jumper each time is kind of a hassle).

2. When my blinky program runs (it also has USB serial support and it prints to the Arduino Serial console), if I press the reset button the computer enumerate the USB connection (good). However, when I am in boot loader mode (BOOT1 = '1'), pressing the resset button does not enumerate the HID USB connection. For that I need to disconnect and reconnect the USB cable. Is this normal? I think it's a better user experience if the reset button also re-enumerate when in HID bootloader mode.


Re: Having problem to make HID bootloaded 2.2

Posted: Mon Aug 17, 2020 6:53 am
by Riffer
When all things are working as planned, you won't have to move the jumper any longer.

Could you check which device shows up after enumeration in the device manager?

Re: Having problem to make HID bootloaded 2.2

Posted: Mon Aug 31, 2020 8:12 pm
by sb1370
I have the same problem (on BOOT1 and normal mode) and after trying various options, flashing several times ,etc. I couldn't get it to work. Only in 1% of times I could get it to get recognized in BOOT mode, though after flashing it wasn't detected again.
It's weird cause I tried other bootloader such as Roger's one or dapboot and neither have this problem.