cancel
Showing results for 
Search instead for 
Did you mean: 

Boot loader flashing fails (occasionally)

Clament John
Associate II
Posted on June 06, 2017 at 14:12

I have an STM32F103 that I'm re-flashing remotely using a different MCU through its UART port (using the boot loader). It works perfectly fine, I have multiple devices that have been successfully flashed with the right code. But occasionally there comes along a device that has stopped working because the STM32 code flashed is not the right one. The whole bin file is flashed using the other MCU, but the STM gets 'bricked'. When I re-flash the device using my PC everything is working again. Why would the hex wrote into to the STM fail?

Brief:

*Using UART bootloader to flash STM32F103

*Occasionally this method fails, and so the STM stops working.

*Is there a method to check if the data written into the code space is valid?

#boot-loader #stm32-f1
2 REPLIES 2
Clament John
Associate II
Posted on June 15, 2017 at 12:28

I'll reply to my question. I came across a few cases.

1. I was not strict in my error checking. I had left out error checking for file open (f_open), file seek (f_seek) etc. Also I wasn't checking if the go command was successful. And so one issue was error checking.

2. Sometimes the data is not written into the flash block. For example there was a scenario where the whole data was sent from the second MCU with a successful go command, so we could assume the new firmware was flashed. But when we read back the flash we saw that a single bye of data (128 bytes) were missed out and so it was 0xFF.

A solution to this would be to read back every 128 byte of data as we write it, and if they do not match then redo the write -the process.

Hope this might help someone else who might come to this thread.

Khouloud GARSI
Lead II
Posted on June 16, 2017 at 12:12

Hi

john.clament

‌,

Thank you for posting your findings. As you said, it may be helpful for someone else facing same issue.

Khouloud.