Hi, I have a code that jumps into a STM32F103C internal bootloader from the the user program.
The code works ok. It is doing its job when I flash the program via serial PA9/PA10.Yes I used arduino for compiling the program and libmaple.I generate a bin file.For serial I used STM flash loader demonstrator.
But when I used ST link v2 with STlink utilities program for flashing the same code(used the same bin file from arduino) is not doing its job it remains stuck in a while loop .If not activated the code jump the main program works ok.
Somebody has some idea why working with serial flashing and not working with STlink v2?
[SOLVED]Interesting problem
[SOLVED]Interesting problem
Last edited by miki on Thu Jan 30, 2020 5:01 pm, edited 1 time in total.
Re: Interesting problem
st-link doesn't connect to the serial (uart) port pa9, pa10 if i understand it correctly. it connects to swd port (swdio, swclk)
and i think it is possible to flash a firmware without jumping to boot room, more commonly just halt the processor and flash away (e.g. openocd)
using st-flash makes it even easier
if you prefer to play with the uart boot loader, it has a dependency on the boot0 jumper (i.e. set boot0, i'm not sure if that can be done in software) and you normally need a usb-uart dongle. and the flasher normally isn't the st-link program (e.g. https://github.com/jsnyder/stm32loader)
in windows stm32cubeprogrammer is a all in 1 tool for the multitude of upload methods
https://github.com/stm32duino/wiki/wiki ... programmer
and i think it is possible to flash a firmware without jumping to boot room, more commonly just halt the processor and flash away (e.g. openocd)
using st-flash makes it even easier
if you prefer to play with the uart boot loader, it has a dependency on the boot0 jumper (i.e. set boot0, i'm not sure if that can be done in software) and you normally need a usb-uart dongle. and the flasher normally isn't the st-link program (e.g. https://github.com/jsnyder/stm32loader)
in windows stm32cubeprogrammer is a all in 1 tool for the multitude of upload methods
https://github.com/stm32duino/wiki/wiki ... programmer
Re: Interesting problem
Maybe I was not clear.I flashed the binary file with FTDI serial on PA9/PA10 with STM flash loader ,...and the program worked.
I re-flashed again the same binary file with STlink v2 on SWDIO and SWCLK pins and the program has problem.
I made a program to jump to internal bootloader because I don't want to use BOOT0 pin or reset pin for flashing. I have a project were BOOT0 pin is not easy to reach or solder on it and the only pins exposed are SWDIO and SWCLK.The STlink v2 with STlink utilities doesn't not allow me to re-flash without using reset pin(don't have access) or BOOT0 pin(don't have acces. Well I soldered one small wire for flashing but this is temporary solution).
In fact I want to use a different pin in place of BOOT0 or better a automatic serial handshake sequence generated by python serial program.
Now that you say it is possible that you flash without BOOT0 or reset pin I'm interested to hear more about that.
I have to use STlink for flashing on this project but without the reset/boot0 pins limitations.
I re-flashed again the same binary file with STlink v2 on SWDIO and SWCLK pins and the program has problem.
I made a program to jump to internal bootloader because I don't want to use BOOT0 pin or reset pin for flashing. I have a project were BOOT0 pin is not easy to reach or solder on it and the only pins exposed are SWDIO and SWCLK.The STlink v2 with STlink utilities doesn't not allow me to re-flash without using reset pin(don't have access) or BOOT0 pin(don't have acces. Well I soldered one small wire for flashing but this is temporary solution).
In fact I want to use a different pin in place of BOOT0 or better a automatic serial handshake sequence generated by python serial program.
Now that you say it is possible that you flash without BOOT0 or reset pin I'm interested to hear more about that.
I have to use STlink for flashing on this project but without the reset/boot0 pins limitations.
Last edited by miki on Mon Jan 27, 2020 8:07 pm, edited 2 times in total.
Re: Interesting problem
i vaguely remember somewhere the manuals about a 'soft boot0' or some sort of it. but i'm not too sure if i indeed remember it correctly.
if that is possible, then it means setting that 'soft boot0' and doing a nvic_sys_reset(), which is as good as pressing reset, hence jumping to the on chip internal boot loader. oops, seemed to be a F4 feature
if that is possible, then it means setting that 'soft boot0' and doing a nvic_sys_reset(), which is as good as pressing reset, hence jumping to the on chip internal boot loader. oops, seemed to be a F4 feature
Last edited by ag123 on Mon Jan 27, 2020 8:20 pm, edited 1 time in total.
Re: Interesting problem
I will try also with NVIC_SystemReset() function see if working with STlink.
Re: Interesting problem
the option doesn't seem there for the F103, i'm not sure if it might be possible to find such a register
nope i'd guess i read SYSCFG incorrectly and misunderstood that
it seemed to be related to memory remap (SYSCFG_MEMRMP), but i'm not sure if it changes the boot pins behavior
it is only there in RM0009 F4 manual
to flash via st-link, in addition to reset, it is also necessary to halt the processor. so it gets tricky e.g. the program needs to run a reset and st-link intercept shortly after to halt the processor. it doesn't seem to be an easy way to do that except like how openocd etc does it. toggling the reset pin physically.
nope i'd guess i read SYSCFG incorrectly and misunderstood that
it seemed to be related to memory remap (SYSCFG_MEMRMP), but i'm not sure if it changes the boot pins behavior
it is only there in RM0009 F4 manual
to flash via st-link, in addition to reset, it is also necessary to halt the processor. so it gets tricky e.g. the program needs to run a reset and st-link intercept shortly after to halt the processor. it doesn't seem to be an easy way to do that except like how openocd etc does it. toggling the reset pin physically.
Re: Interesting problem
Listen The program is already working jumping to bootloader but only when i flash with FTDI serial,
With stlink is not but only the jump itself has problem, the main program is still working.
I don't get what is changed when running the program when flashed with STlink versus flashed with USB serial.Both were successful but different behavior.
With stlink is not but only the jump itself has problem, the main program is still working.
I don't get what is changed when running the program when flashed with STlink versus flashed with USB serial.Both were successful but different behavior.
Re: Interesting problem
There is a lot of settings in the STlink Utility app - Option Bytes atc.
Doublecheck whether there is not something set such it is disturbing..
Doublecheck whether there is not something set such it is disturbing..
Pukao Hats Cleaning Services Ltd.
Re: Interesting problem
I'm using the STM core v1.8.0 without any bootloader.The STlink v2 with STlink utilities doesn't not allow me to re-flash without using reset pin
There are three wires connected from the ST-Link adapter - SWDIO, SWCLK, and GND.
Power is via the USB port. Both boot jumpers are at 0.
Uploading the binary file from Arduino IDE works every time.
1,8.0 uses the STM32Cube Programmer.
I never had much success using libmaple with the ST-Link.
F103C boards (blue/black pills) and Maple mini work without any issues on the new core with the ST-Link adapters.
Re: Interesting problem
Thanks for your input .
I write my program using maple lib not so much arduino but manipulating directly registers.I don't feel like changing the core.
I will check with STM32CubeProgrammer see if working.
I write my program using maple lib not so much arduino but manipulating directly registers.I don't feel like changing the core.
I will check with STM32CubeProgrammer see if working.