Page 1 of 1

Uploading hex files to stm32f103

Posted: Wed Nov 11, 2020 12:09 am
by FGS
Hey !

I guess it is pretty obvious but as i have hard time to find the info i m still asking - what is the best way to upload a .bin file to a stm32f103 ?
I ve read some people use the command prompt to upload the file but i did not found a clear instruction. I m using a FTDI programmer so i would prefer a solution which uses it !

Thanks !

Re: Uploading hex files to stm32f103

Posted: Wed Nov 11, 2020 12:15 am
by GonzoG
You can use STM32CubeProgrammer

Re: Uploading hex files to stm32f103

Posted: Wed Nov 11, 2020 12:25 am
by mrburnette
STLink:
https://stm32duinoforum.com/forum/viewt ... _3645.html

Other:
https://github.com/rogerclarkmelbourne/ ... /Uploading
Generic / unbranded STM32F103 boards
The easiest way to upload to these board is to use a USB to Serial adapter connected to Hardware Serial 1 (Pins PA9 and PA10).

Additionally to enter serial bootloader mode, these boards, need to be configured so that Boot0 is HIGH and Boot1 is LOW. On most boards these pins are either connected to jump links or to switches.

To upload the board must be reset (with Boot0 HIGH and Boot1 LOW), so that the board enters serial bootloader mode. Once the upload is complete, the bootloader is instructed to run the code that has just been uploaded.

Note. If the board is reset again, the code will not run if Boot0 is still HIGH etc, so once development is complete, both Boot0 and Boot1 need to be set to LOW so that the code is run immediately after power on or restart.

The additional benefit of using a USB to Serial converter, is that for debugging, Serial.print() etc are sent to the same serial port that is use for uploading, and the whole build and debugging process is very much like using an Arduino Pro Mini board.
1) Powered separately w/ common PC ground:
Image


2) Powered by USB-Serial 3.3V output:
Image

Command line binary (write/overwrite bootloader):
https://github.com/rogerclarkmelbourne/ ... ws-command

More:
https://stm32duinoforum.com/forum/viewt ... tml#p45479

Re: Uploading hex files to stm32f103

Posted: Wed Nov 11, 2020 12:41 pm
by FGS
Thanks everyone !!! That s really helpfull :D

Re: Uploading hex files to stm32f103

Posted: Thu Nov 12, 2020 5:11 pm
by FGS
GonzoG wrote: Wed Nov 11, 2020 12:15 am You can use STM32CubeProgrammer
So dowmload it ready to upload but ... Which adress should i write the bin file to ? I m wondering if 0#08000000 is the adress for the bootloader and if my bin file should start at a further adress.

Thank you !

Re: Uploading hex files to stm32f103

Posted: Thu Nov 12, 2020 5:16 pm
by FGS
FGS wrote: Thu Nov 12, 2020 5:11 pm
GonzoG wrote: Wed Nov 11, 2020 12:15 am You can use STM32CubeProgrammer
So dowmload it ready to upload but ... Which adress should i write the bin file to ? I m wondering if 0#08000000 is the address for the bootloader and if my bin file should start at a further adress.

Thank you !
Edit : just checked with my arduino IDE - adress is 0#08000000 :)

Re: Uploading hex files to stm32f103

Posted: Thu Nov 12, 2020 7:55 pm
by GonzoG
FGS wrote: Thu Nov 12, 2020 5:11 pm So dowmload it ready to upload but ... Which adress should i write the bin file to ? I m wondering if 0#08000000 is the adress for the bootloader and if my bin file should start at a further adress.

Thank you !
If you're using usb<->ttl programmer you don't need additional bootloader so you can upload program at the beginning of flash memory.