Uploading hex files to stm32f103

Post here first, or if you can't find a relevant section!
Post Reply
FGS
Posts: 6
Joined: Mon Jun 08, 2020 5:48 pm

Uploading hex files to stm32f103

Post 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 !

GonzoG
Posts: 80
Joined: Wed Jan 15, 2020 11:30 am
Answers: 5

Re: Uploading hex files to stm32f103

Post by GonzoG »

You can use STM32CubeProgrammer

mrburnette
Posts: 311
Joined: Thu Dec 19, 2019 1:23 am
Answers: 1

Re: Uploading hex files to stm32f103

Post 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

FGS
Posts: 6
Joined: Mon Jun 08, 2020 5:48 pm

Re: Uploading hex files to stm32f103

Post by FGS »

Thanks everyone !!! That s really helpfull :D

FGS
Posts: 6
Joined: Mon Jun 08, 2020 5:48 pm

Re: Uploading hex files to stm32f103

Post 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 !

FGS
Posts: 6
Joined: Mon Jun 08, 2020 5:48 pm

Re: Uploading hex files to stm32f103

Post 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 :)

GonzoG
Posts: 80
Joined: Wed Jan 15, 2020 11:30 am
Answers: 5

Re: Uploading hex files to stm32f103

Post 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.

Post Reply

Return to “General discussion”