Having problem to make HID bootloaded 2.2

Bootloader for STM32F103 and STM32F4xx micro-controllers
No special driver is required. Support for Windows, Linux and Mac Operating System
zapta
Posts: 10
Joined: Sun Aug 02, 2020 7:41 pm

Having problem to make HID bootloaded 2.2

Post 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 https://github.com/Serasidis/STM32_HID_ ... 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?

Thanks,
Z.
Attachments
Annotation 2020-08-02 162646.png
Annotation 2020-08-02 162646.png (22.4 KiB) Viewed 2401 times

mrburnette
Posts: 275
Joined: Thu Dec 19, 2019 1:23 am
Answers: 1

Re: Having problem to make HID bootloaded 2.2

Post by mrburnette »

Check out Roger's WiKi:
https://github.com/rogerclarkmelbourne/ ... Bootloader


Other links:
Available cores

1. The current STM32F1/F4 core files (Leaflabs-based core) for the latest version of ArduinoIDE for clone boards
https://github.com/rogerclarkmelbourne/Arduino_STM32
- The original documentation from Leaflabs ... the Maple commercial project that lasted only a few years
http://docs.leaflabs.com/docs.leaflabs.com/index.html
- WiKi resources
https://github.com/rogerclarkmelbourne/ ... STM32/wiki and
http://stm32duinoforum.com/forum/index. ... =Main_Page

2. The current STM32 core files for STM32 based boards (official STM core, HAL based)
https://github.com/stm32duino/Arduino_Core_STM32
- Please address all hardware or core questions for Nucleo boards in this sub-forum: http://stm32duinoforum.com/forum/viewforum.php?f=29

3. An alternative generic core: *OUTDATED not under active development * edited: 23.08.2018
https://github.com/danieleff/STM32GENERIC

4. An alternative F4 core for generic F4 boards edited 26.10.2018
https://github.com/stevstrong/Arduino_STM32/
Supported features: http://stm32duinoforum.com/forum/viewto ... 976#p26166 [edited by stevestrong - 29.10.2018]
Please refer to this post for specifics.


Specific boards

*RobotDyn Black Pill: http://stm32duinoforum.com/forum/index.php?ti ... Black_Pill
Blue Pill: http://stm32duinoforum.com/forum/index. ... =Blue_Pill
Red Pill: http://stm32duinoforum.com/forum/index. ... e=Red_Pill
Black Pill: http://stm32duinoforum.com/forum/index. ... Black_Pill
Maple Mini: http://stm32duinoforum.com/forum/index. ... Maple_Mini

stevestrong
Posts: 315
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 7
Location: Munich, Germany
Contact:

Re: Having problem to make HID bootloaded 2.2

Post 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.

zapta
Posts: 10
Joined: Sun Aug 02, 2020 7:41 pm

Re: Having problem to make HID bootloaded 2.2

Post 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.

mrburnette
Posts: 275
Joined: Thu Dec 19, 2019 1:23 am
Answers: 1

Re: Having problem to make HID bootloaded 2.2

Post by mrburnette »

https://scienceprog.com/flashing-progra ... 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:

Image

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:

Image

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.

stevestrong
Posts: 315
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 7
Location: Munich, Germany
Contact:

Re: Having problem to make HID bootloaded 2.2

Post by stevestrong »

Additionally to Ray's comment:
https://github.com/Serasidis/STM32_HID_ ... /README.md
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.

Riffer
Posts: 3
Joined: Sat Aug 08, 2020 7:11 pm

Re: Having problem to make HID bootloaded 2.2

Post 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.

zapta
Posts: 10
Joined: Sun Aug 02, 2020 7:41 pm

Re: Having problem to make HID bootloaded 2.2

Post 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.

Thanks,
Z.

Riffer
Posts: 3
Joined: Sat Aug 08, 2020 7:11 pm

Re: Having problem to make HID bootloaded 2.2

Post 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?

sb1370
Posts: 1
Joined: Mon Aug 31, 2020 7:08 pm

Re: Having problem to make HID bootloaded 2.2

Post 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.

Post Reply

Return to “STM32 HID bootloader”