cancel
Showing results for 
Search instead for 
Did you mean: 

programming STM32F0 over UART

pietro2
Associate II
Posted on July 08, 2013 at 14:53

Hi guys, i need to program a stm32f0 mcu using a serial cable.

At this moment i'm using an external St-link device.

Can i use only a serial cable without st-link (e.g. over hyper terminal)?

#uart
10 REPLIES 10
Posted on July 08, 2013 at 16:16

Depends what you mean. Hyper Terminal is probably not a fantastic vehicle to do it.

You can write your own code to do anything you want, the IAP examples for the STM32 series in general use a Y-Modem protocol, but you could use something else.

To use the System Loader (BOOT0=High) you're going to have to use something like the Flash Demonstrator application, which implements a unique protocol to program a blank chip. This is not compatible with a terminal application.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
crt2
Associate II
Posted on July 09, 2013 at 10:14

I have python script written (adjusted stm32loader) for this, but its for:

# these come from AN2606

chip_ids = {

    0x412: ''STM32 Low-density'',

    0x410: ''STM32 Medium-density'',

    0x414: ''STM32 High-density'',

    0x420: ''STM32 Medium-density value line'',

    0x428: ''STM32 High-density value line'',

    0x430: ''STM32 XL-density'',

    0x416: ''STM32 Medium-density ultralow power line'',

    0x411: ''STM32F2xx'',

    0x413: ''STM32F4xx'',

}

If you find your chip in this documentation, then this is what you're looking for.

pietro2
Associate II
Posted on July 09, 2013 at 16:19

well, my mcu code is : STM32F051R8T6.

Datasheet says ''Low and Medium density...''

Anyway in AN2606 (page 80) we can read that the STM32F051xx device is supported.

Well, can you describe me the programming phase step by step, please?

Thanks a lot.

crt2
Associate II
Posted on July 09, 2013 at 16:55

This will tell you everything you need: https://github.com/jsnyder/stm32loader

I will upload my code there when I am sure I got everything made as it should.

zzdz2
Associate II
Posted on July 10, 2013 at 08:44

Well, can you describe me the programming phase step by step, please?

 

It's detailed in AN3155

pietro2
Associate II
Posted on August 29, 2013 at 11:57

hi clive1, sorry for longer reply.

I build a simple interface circuit between pc and uart micro's pins.

It's the seguent chain

PC- USB to Rs232 - MAX232(rs232 to usart adapter) - mcu UART (PA9, PA10) .

After i set high Boot0 pin using a jumper with vdd pin (using the stm32f0discovery board).

I'm sure that's work because i can read correct srtings using some terminal software.

If i open the Flash Loader Demonstrator it says that the mcu is unrecognizable.

Where is the matter?

pietro2
Associate II
Posted on August 29, 2013 at 12:02

thanks for the script, but there are some problem

using the seguent command

python ''path''/stm32loader.py -e -w -v myprogram.bin

it says ''Can't init. May be already running?''

Do you can help me, please?

thanks

crt2
Associate II
Posted on August 29, 2013 at 15:50

Hm, ok first of that python at start is not needed because script already has

#!/usr/bin/env python

. All you need to do is chmod +x it, to get it executeable. Next you will have to run it as superuser so sudo ...

I cant find your error message anywhere so I will assume it comes from one of error prints. It could mean that you already have something running on that serial/USB port that you are wanting to flash through (although again your command does not tell which USB port to use, so I will assume you've changed the config).
pietro2
Associate II
Posted on August 30, 2013 at 09:21

Goodmorning, sorry but i used a different script, it's stm32loader.py from tuxotronic website.

Anyway i've overwrite the script, and now the message is:

''Can't init. Ensure that BOOT0 is enabled and reset device.''

But Boot0 is enabled, i'm sure because if disable it starts old code in my board.

And i'm so sure about the cable correct work, because in other applications i use it for send and receive commands on other terminals.