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" (not exactly bricked, it's just has a wrong code). 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?
*The STM is not bricked, it's just a wrong code inside the flash. When I read back the flash from the code space, this is smaller than the file that should have been flashed.
*I'm using the STM in system boot mode. [AN2606]