Flash Self Write issues
Hi.
I'm having some difficulties with the flash self write. This is a 2 part question, they are related but most likely with different causes and solutions.
Background:
I'm using a STM32L476R6T6 (256Kb flash) and I have a bootloader that erases the uC memory, except for the first 12Kb were it resides. It works nice and I have at least 500 units running without problems.
All the bootoader code is based on an old release of the ST library (r1.5) but modified to avoid using interrupts for timeouts
1) I found 1 uC that is not working. It used to. It was my development unit, and after some temperature cycling (-10oc and 70oC) it started to behave like this.
The code was hanging after I tried to update to a new firmware using the bootloader. After some debugging I noticed that the BL is able to erase only the first 128Kb, but it just does nothing with the upper 128Kb.
Since I can write the initial firmware to the uC, i means that ST Link (or at least Mass Erase) works without problems.
Is there anything I can try? Is it possible that this part become defective? Still, it is odd that I can program the part via SWD.
I'm worried that it is some thing critical in my firmware but can't figure what it may be.
2) This happens in all units and at least is consistent. I just need to know if this is a normal behaviour or not.
My bootloader checks if the uC is code protected and if not, enabled Code Protect Level 1.
The problem is that after I call FLASH_OB_Launch, I was expecting the uC to reset and start executing the code again, but it gets stuck and the only way to start it again is thru a power cycle. Is that the expected behaviour?
So far I was able to deal with it, but in this new version of the product I'll have a 1F cap in the power supply, so, a a power cycle will be a little bit more of a challenge.
Thanks, Mauricio Scaff
