cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Built-in Bootloader

TPrio.1
Associate II

Hello everyone,

I am working on an application about updating stm32f103 via built-in bootloader - uart.

I have a bin file that is validated with cheksum equal to st-link utility tool. (sum all the bytes).

My issue is that sometimes with the same bin file the mcu doesnt work properly. I have read flash memory (via st-link utility tool) and i observed that some addresses are corrupted compared to original bin file.

Why happen this? I try to change baud rates but this issue appear again.

My bootloader version is 2.2

I appreciate if someone could help me on that.

8 REPLIES 8

>>Why happen this? I try to change baud rates but this issue appear again.

Well the flash integrity/performance is dependent on the power supply. Could be an issue there if the erase/write currents exceed expectations.

Use checksum methods with better integrity, something like a CRC or hashing function (MD5, SHA, ..), sign the binary out of the linker, have the firmware confirm or output an error messages, or flag failure in some way.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
TPrio.1
Associate II

thanks for your answer.

I will measure the power supply but i dont think that i have some issue in there.

TPrio.1
Associate II

Tomorrow i am going to use crc-16 to be sure that the file is not corrupted

The thing shouldn't spontaneously corrupt, do you see this only in your board, or more generally available ones?

Any flash writing code within your application? EEPROM Emulation?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

Aaa yeah, i am using one flash memory page in linker in order to save some configuration values. Maybe this can cause an issue?

Yes, quite easily.

As the F1 has uniform size sectors, shrink the size visible to the linker, and place this data at the way far end of the memory arena.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

I am using the last page of the flash memory to store data, but i have the option to use an external memory instead of the internal's mcu. What is your suggestion about? Do you believe that if i restore the flash memory into intial state (just only for application code) then the bootloader will work properly?

you make my day! The file has been downloaded correctly after restoring the linker script into the initial value.

But i observe that the program stop executing properly after go command, i have to reset it from the power supply not only the reset button. Could you please give me some help on this?