Having a problem with bootloader after uploading code

Bootloader for STM32F103 and STM32F4xx micro-controllers
No special driver is required. Support for Windows, Linux and Mac Operating System
soniccd123
Posts: 3
Joined: Mon Dec 30, 2019 6:09 pm

Having a problem with bootloader after uploading code

Post by soniccd123 »

Hello,

I am trying to use STM32duino core for some time now with the HID Bootloader and a STM32F103 bluepill. I can flash the bootloader with the stm32flash and a USB-Serial adapter thing and my PC recognizes the device. I set boot0 to 0 and it continues to recognize it normally. The problem is when i upload code through Arduino IDE. I select the HID bootloader as upload method, the upload occours normally, but when it finishes uploading and the Bluepill resets, windows stops to recognize the device and i cannot upload anything anymore. The strange thing is that the code works normally on the bluepill, its only like the bootloader became corrupted. The same happens with Maple bootloader 2.0. Someone has ever had this problem? Can someone help me?

Thanks
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: Having a problem with bootloader after uploading code

Post by stevestrong »

After you upload your code and restart the device, the bootloader is no longer active.
So if you have not activated USB serial in your uploaded code, then the PC cannot recognize anything, is normal.
soniccd123
Posts: 3
Joined: Mon Dec 30, 2019 6:09 pm

Re: Having a problem with bootloader after uploading code

Post by soniccd123 »

stevestrong wrote: Tue Dec 31, 2019 9:50 am After you upload your code and restart the device, the bootloader is no longer active.
So if you have not activated USB serial in your uploaded code, then the PC cannot recognize anything, is normal.
I'll give it a try, the thing is that i can't upload any new code after the first upload.

Thanks
User avatar
Vassilis
Posts: 23
Joined: Wed Dec 18, 2019 3:04 pm
Location: Thessaloniki, Greece
Contact:

Re: Having a problem with bootloader after uploading code

Post by Vassilis »

stevestrong is right. Please select these settings

hid_bl.PNG
hid_bl.PNG (14.93 KiB) Viewed 20475 times
Vassilis Serasidis
https://www.serasidis.gr
fredbox
Posts: 125
Joined: Thu Dec 19, 2019 3:05 am
Answers: 2

Re: Having a problem with bootloader after uploading code

Post by fredbox »

Set BOOT1 = 1 and press reset to see if the HID bootloader is still available.
From the hid-bootloader readme:

Code: Select all

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.
soniccd123
Posts: 3
Joined: Mon Dec 30, 2019 6:09 pm

Re: Having a problem with bootloader after uploading code

Post by soniccd123 »

Vassilis wrote: Tue Dec 31, 2019 6:04 pm stevestrong is right. Please select these settings


hid_bl.PNG
Thanks! That just worked, it was the USB support CDC setting!

Thanks for everybody who tried to help too!
gonzam93
Posts: 1
Joined: Thu Apr 09, 2020 3:50 pm

Re: Having a problem with bootloader after uploading code

Post by gonzam93 »

I need in favor if you can pass me that library. The ones I manage don't work. thanks
mauriziostm32
Posts: 23
Joined: Sat Mar 21, 2020 3:18 pm
Answers: 1

I'm having problems too

Post by mauriziostm32 »

Hi Guys

First of all thanks to Vassilis for this bootloader and to all the other that are helping and pushing on...
I like the idea to have a Hid Bootloader... but maybe I didn't entirely understand the concept..
It is clear what Stevestrong punctuated: after you upload the first sketch the Bootloader is not more active... you have to call it back by boot 1 on Black-blue pill... I tried with the Official STM32 core and with my first love Roger's core

My final aim is to give to the final user of my project a packed exe containing a .bat hid-flash.exe and the xxxx.bin…



Trying with Roger Core
Trying with Roger Core and HID-bootloader 2.1.0 on windows 7 with the last Arduino ide 1.8.12: after the bootloader is loaded by ST-LINK V2... windows 7 doesn't require drivers you can upload the bin... after the first upload... windows 7 recognize the device as maple... but if you don't install the maple serial drivers you cannot upload further sketches.... with windows 10 the OS search for the drivers online and install the serial driver... so the device is recognized as serial-usb maple device... a .bat with hid-flash.exe and the xxxx.bin… would work specifying the Serial port...

Here is where I don't understand the concept of the HID bootloader... the advantage of it is to not have to use drivers... if after the first sketch is uploaded I need drivers... I don't understand the point... am I missing something?

Is there a way to call the bootloader 1 (pin 20 PB2) to get high by code? I know I can connect another Digital output to pin 20 (connected to a 10K pulldown) and pull it up if I want to put the MCU in hid bootloader... I can do it , no problem … I need to redesign my PCB... but is there a code way?

Trying with STM32 Core
Then I thought... Vassilis is now pushing on the official STM32 core... maybe a workaround is already there... let's try...
On another machine (w7) I installed the official CORE and installed also CUBE... uploaded the HID bootloader 2.2.2 by ST-LINK V2.
First upload is working... I configured the board as the suggestions given by Vassilis's attached picture but then.... " bluepill cdc in FS Mode" with a yellow mark... it seems a driver is required… I didn't modify the resistor... and I tried with a blackpill that has the correct value resistor but the result is the same
Am I doing something wrong? or maybe i misunderstood that "no driver required" it is meant no driver is required for the first upload?

Thanks

Maurizio
Attachments
non funzia.png
non funzia.png (45.65 KiB) Viewed 19160 times
User avatar
fpiSTM
Posts: 1723
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Having a problem with bootloader after uploading code

Post by fpiSTM »

For the STM32 core as fhe VID is the ST one and PID is the one for CDC drivers the generic driver for Windows is enough.
Why you get a yellow mark I don't know. what is the issue in the properties?
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: Having a problem with bootloader after uploading code

Post by stevestrong »

Trying with the Roger's core you did everything fine, for the bootloader you do not need any special driver.
The driver comes in play when your sketch is working (after the bootloder became inactive).
Unfortunately, in the current situation you need that serial driver.

I am currently working on a very simplified USB CDC part which do not require the Libmaple driver, it will be enumerated directly by any system as usual COM port. Honestly, I do not know why it wasn't implemented from the beginning such a CDC driver.
I will soon commit it into my repository and if Roger gives his consent then also in his repository.

p.s.I am also working on a CDC bootloader which does not require special driver, but that is a totally different story ;)
Last edited by stevestrong on Sun Apr 19, 2020 10:10 am, edited 2 times in total.
Post Reply

Return to “STM32 HID bootloader”