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
GonzoG
Posts: 403
Joined: Wed Jan 15, 2020 11:30 am
Answers: 27
Location: Prudnik, Poland

Re: Having a problem with bootloader after uploading code

Post by GonzoG »

parisianos wrote: Wed Jan 19, 2022 6:03 pm For me I have the same problem but not valide solution. Blackpill not accept any program. I have the same config that you write. I try anything and nothing works. Thanks
There are few different "black pills". You have to be more precise.
Also, are you sure you have a genuine ST chip ?
parisianos
Posts: 11
Joined: Tue Jan 18, 2022 11:17 pm

Re: Having a problem with bootloader after uploading code

Post by parisianos »

Thank you for your reply. Yes it have the genuine st chip. I worked with this card more than 15 days without problem. After the last working it don't want to download sketch from Arduino. Blackpill seems bloqued. I have a second same card and this work fine for the moment. With the same config.
Thanks
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Having a problem with bootloader after uploading code

Post by ag123 »

you need to state a couple of things, e.g. what mcu is on that black pill is that a stm32f401 or f411?
https://stm32-base.org/boards/
if it is a stm32f401 or f411it doesn't need a separate bootloader. The usb (dfu) bootloader is built in on chip.
The finger dance normally is
- press both reset and boot0
- hold boot0, release reset
- release boot0 2 sec later
then you can use the st-link programmer to program the sketch over usb, only a plain usb cable is needed
GonzoG
Posts: 403
Joined: Wed Jan 15, 2020 11:30 am
Answers: 27
Location: Prudnik, Poland

Re: Having a problem with bootloader after uploading code

Post by GonzoG »

parisianos wrote: Fri Jan 21, 2022 2:37 pm I worked with this card more than 15 days without problem. After the last working it don't want to download sketch from Arduino.
If it worked before, then probably there's a problem with program uploaded to board. (eg. If you forgot to enable USB CDC, then IDE won't be able to reset board into bootloader, as there is no COM port to connect with board.)
But we still need more information, at least which MCU.

You can manually reset board into bootloader:
On F103, by setting BOOT1 jumper to 1 and resetting board.
On F4x1, by resetting board while holding KEY pressed.
parisianos
Posts: 11
Joined: Tue Jan 18, 2022 11:17 pm

Re: Having a problem with bootloader after uploading code

Post by parisianos »

Thank you for your reply
It's a F411CE genuine chip. It worked before very fine. I didn't change the config. All stay the same. And with my second card works fine. My first card who has problem after wanted download the sketch from arduino. Nothing change in configuration. I test with a multimeter the buttons Reset and Boot if they have problem and I think are ok.
Also it's not regognized by the pc and com ports. I test with another computer. The same problem with one of the two same cards. Thank you
I have this message:
Arduino : 1.8.16 (Windows 10), Carte : "Generic STM32F4 series, BlackPill F411CE, STM32CubeProgrammer (DFU), Enabled (generic 'Serial'), CDC (generic 'Serial' supersede U(S)ART), Low/Full Speed, Smallest (-Os default), None, Newlib Nano (default)"
-------------------------------------------------------------------
STM32CubeProgrammer v2.9.0
-------------------------------------------------------------------
Error: Target device not found

Establishing connection with the device failed

le port série sélectionné Establishing connection with the device failed

n'existe pas ou votre Arduino n'est pas connectée
GonzoG
Posts: 403
Joined: Wed Jan 15, 2020 11:30 am
Answers: 27
Location: Prudnik, Poland

Re: Having a problem with bootloader after uploading code

Post by GonzoG »

If it's not recognized then you uploaded program without USB support, otherwise it would be recognized as COM port.
Also, you have selected DFU as an upload method, which needs board manually reset into DFU mode (using BOOT and reset buttons).
But uploading program using any other method then HID bootloader will remove HID bootloader from board.
parisianos
Posts: 11
Joined: Tue Jan 18, 2022 11:17 pm

Re: Having a problem with bootloader after uploading code

Post by parisianos »

Thank you. How is possible to upload without USB support? The card worked before the last upload to arduino. Never deconnected. I maked some uploads and the last upload was the last. Resetting board while holding KEY pressed not change something. Not work for me
I always used Boot and Reset buttons. With the other same card all are ok, without problem.
What do you mean uploading program using any other method then HID bootloader will remove HID bootloader from board ?
I don't remember if I tried the last time to upload with the HID bootloader. I am not sure
Thank you for your time
GonzoG
Posts: 403
Joined: Wed Jan 15, 2020 11:30 am
Answers: 27
Location: Prudnik, Poland

Re: Having a problem with bootloader after uploading code

Post by GonzoG »

If you used DFU (boot, reset buttons), then you never had HID Bootloader. And this topic is about HID bootloader.

You're using DFU to upload, so you need to reset board into DFU mode. It can be tricky on some blackpills because it's a really badly designed part of those boards.
Those blackpills, while resetting, can cause shorts on USB power, and even fry USB on PC or USB pins on MCU.

If you don't have USB-TTL adapter or ST-Link, you'll need to reset it into DFU mode. There is no other way to upload anything.
If it reset into DFU, it will be in device manager as "STM32 BOOTLOADER".
parisianos
Posts: 11
Joined: Tue Jan 18, 2022 11:17 pm

Re: Having a problem with bootloader after uploading code

Post by parisianos »

Thank you. What do you mean if it reset into DFU, it will be in device manager as "STM32 BOOTLOADER" ?
I haved into device manager "STM32 BOOTLOADER".
I push Reset button,........nothing. I push BOOT and Reset,.......nothing
How reset board in DFU mode ? I tried everything
With Reset button don't works and with the PIN NRST nothing too.
Thanks
GonzoG
Posts: 403
Joined: Wed Jan 15, 2020 11:30 am
Answers: 27
Location: Prudnik, Poland

Re: Having a problem with bootloader after uploading code

Post by GonzoG »

Exactly what I wrote.
When MCU boots into DFU mode it will be recognized by Windows as "STM32 BOOTLOADER", not a COM port.
Then you can upload any program/sketch to it using DFU upload method.

To reset MCU into DFU mode, press BOOT, press NRST, release NRST, after a second release BOOT.
It might not work every time, it might even work every 100th time.
Post Reply

Return to “STM32 HID bootloader”