Bootloader for programming with Serial Port CDM function

Post here first, or if you can't find a relevant section!
Post Reply
moelski
Posts: 7
Joined: Mon Jan 18, 2021 5:15 am

Bootloader for programming with Serial Port CDM function

Post by moelski »

Hi !

I´m a little bit lost regarding available / usefull bootloader possibilities with STM F1 and F4.
I do a development which uses the F1 at the moment (Blue Pill). Next step is to port this to an F4 (405RG) chip.
For uploading code I use an FTDI adapter and UART1.

Now there is alsways this nice USB port I´d like to use - but whats the best methode?
Is it possible to use an F1 or F4 with a USB Bootloader function which also provides a USB virtual COM port when used in normal operation (for debugging purposes)?
This would free up one serial port (UART1) for other things.

Maybe there is any overview of possibilities I haven´t found yet :roll:

regards
Dominik
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: Bootloader for programming with Serial Port CDM function

Post by mrburnette »

moelski wrote: Sun Jan 31, 2021 1:38 pm I´m a little bit lost regarding available / usefull bootloader possibilities with STM F1 and F4.
For Roger's core (libmaple):
https://github.com/rogerclarkmelbourne/ ... wiki/Linux

For STM's Official Core:
https://github.com/stm32duino/wiki/wiki

More helpful links viewtopic.php?f=2&t=301

From the Internet Archieve:
Known issues
The micro-USB connector is not soldered to the board very well and is easily broken.
There are multiple versions of this board with different connectors. Refer to the pictures for examples. You can increase the strength by re-soldering the connector and possibly covering the connector in epoxy glue or hot-melt glue.

The 3.3V voltage regulator is a very small, knock-off device. It overheats quickly and often has no thermal protection, feeding through its input voltage when it fails.
It's recommended to power external components with another regulator so that the power draw on the Blue Pill does not exceed 100 mA.

Analogue power and ground is connected directly to digital power and ground, which can cause additional noise on the ADC input.
The reset button on some of these boards is very hard to press.
There is no dedicated USB reset circuitry on this board.
There is no Schottky diode between USB +5V and system VIN power. So you cannot power the board directly from a 5 Volt supply, and use USB at the same time.
Most bluepill boards have the wrong pullup resistor value which prevents native USB from working properly. The R10 resistor should have a value of 1k5 and be pulled up to 3v3. In spite of this flaw, native USB will work on some PCs. Try the board on your PC before you bother changing the resistor.
Blue_pill_bottom_photo.jpg
Blue_pill_bottom_photo.jpg (58.13 KiB) Viewed 2399 times
ag123
Posts: 1657
Joined: Thu Dec 19, 2019 5:30 am
Answers: 25

Re: Bootloader for programming with Serial Port CDM function

Post by ag123 »

to keep things simple / short and sweet.

I'd assume you have figured out how to install a sketch/firmware using the usb serial dongle (e.g ft232, ft2232 etc).
that method can be used on both stm32f1 and stm32f4. just that for stm32f4 there is the additional 'usb dfu upload' i.e. after you set boot0.
press reset you can actually upload a sketch to it using usb-dfu. read up more from the links ray suggest and st's wab
https://www.st.com/resource/en/applicat ... ronics.pdf
https://www.st.com/resource/en/applicat ... ronics.pdf
https://learn.adafruit.com/adafruit-stm ... er-details
and for this you only need a usb-cable to upload firmware / sketch

now for serial.
for libmaple (roger's and steve's (f4) core), usb-serial is default
so Serial.println("hello world"); goes to your serial monitor

for the official STM core you'd only need to choose USB Serial (CDC) and you have the same thing
Serial.print("hello world"); goes to your serial monitor

-----------
boot loader - that is a *much* longer story
in the beginning genisis, it started here
https://www.leaflabs.com/maple
http://docs.leaflabs.com/static.leaflab ... dex-2.html
http://docs.leaflabs.com/static.leaflab ... oader.html

then roger as an individual started a forum with this as the domain hosted the core on github
https://github.com/rogerclarkmelbourne/Arduino_STM32
roger and this community improved on the core

and roger improved on the bootloader as well
https://github.com/rogerclarkmelbourne/ ... Bootloader
https://github.com/rogerclarkmelbourne/ ... bootloader

then some other enterprising individuals created this one
https://github.com/Serasidis/STM32_HID_Bootloader

and somewhere along the way came the official STM core
https://github.com/stm32duino/Arduino_Core_STM32

it is an interesting little history

the usb (dfu) bootloader is mainly for the stm32f103 it makes it a little more convenient as all you need is a usb-cable to upload the sketch
no additional usb-uart dongles needed

otherwise using a usb-uart dongle or st-link v2 dongle is a bullet proof way to install firmware / sketch on stm32 devices.
it is supported by the hardware internally and is the recommended de-facto method
----
if you happen to be using roger's libmaple core, there is this little sketch deep inside the examples
that makes the stm32f103 pill board a usb-uart dongle
https://github.com/rogerclarkmelbourne/ ... -w-signals

so that can then be used as another usb-uart dongle to interface/program other stm32s, other mcus etc
the notion is if you have a board with roger's bootloader, installed on at least a pill board.
and you misplaced your usb-uart, now you have a 'software' solution to get a usb-uart
this sounds a little like reprap, having a little stm32duino pill, it'd make another one :lol:
https://reprap.org/wiki/RepRap
btw that isn't even an illusion
https://www.aliexpress.com/item/4001039599237.html
https://all3dp.com/4/marlin-releases-st ... -firmware/
https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3
Post Reply

Return to “General discussion”