Suggestion for simplifying installation of stm32duino USB bootloader

What could be included in further releases, or for the forum.
Post Reply
profdc9
Posts: 50
Joined: Mon Jun 11, 2018 11:20 am

Suggestion for simplifying installation of stm32duino USB bootloader

Post by profdc9 » Thu Jun 14, 2018 1:10 pm

Hello,

I just got my Blue Pill in the mail and I set it up and I have to say that the STM32duino/Leaf Labs system is pretty cool. It definitely takes a lot of the pain out of the development process for 32-bit microcontrollers, for example, programming CMSIS on LPC2148/2368/1768 processors that I have done in the past, so it's more likely that projects can be used by others.

I have one suggestion perhaps for simplifying the installation. I got the ST-link and a Blue Pill, and I use the instructions to install the USB bootloader "generic_boot20_pc13.bin" using the ST-link. It took me a little while, however, to figure out that I need to put it into perpetual bootloader mode by moving over the BOOT1 jumper to be able to flash my first sketch into the microcontroller. I think this is because the USB serial has to be polled after each iteration of the loop() so that the special characters can be sent to the processor so that it is reset and the bootloader mode can be accessed, and the VID/PID goes from 1eaf:0004 to 1eaf:0003 when this happens. The file "generic_boot20_pic13.bin" doesn't have this loop I think when the processor is first flashed, so that it is not waiting for these characters. Therefore you have to put it into perpetual bootloader mode by moving over the BOOT1 jumper the first time so that you can upload a sketch.

Would it be possible to modify the "generic_boot20_pc13.bin" so that there is effectively something like a "Blinky" sketch, or just a delay loop, that polls the USB serial the first time it is flashed, so that perpetual bootloader mode is not required the first time? After the first sketch is uploaded, the delay loop would be overwritten and the sketch that is uploaded would have a loop() in it that would poll for the characters. The only downside to this is that if for some reason the uploaded sketched crashed the processor so that the processor was no longer polling the USB serial, perpetual bootloader mode would need to be invoked to write a new sketch.

If that is not possible, perhaps the instructions could be amended to add that if after one writes the "generic_boot20_pc13.bin" to the processor, one might need to enter perpetual bootloader mode by moving over the BOOT1 jumper (or for boards that don't have the jumper but do break out PB2, typing PB2 to high with a pullup resistor) so that the perpetual bootloader mode is entered. Or the both the change could be made to the bootloader and this mentioned in the documentation. I did not see this in the instructions, but perhaps it is there.

Anyways again I think STM32duino has taken a lot of pain out of 32-bit microcontrollers nonetheless. Thank you for your hard work.

Dan

Post Reply