2024-09-09 01:14 AM
I have a STM32G030K8 processor that needs to write some stuff to memory as soon as it detects that it will be losing power - always a bad time but I have to do this.
Most of the time it seems to be doing this just fine but once in a while the processor gets corrupted.
Here is the problem though, I have write protected the code space and the only pages not write protected are two pages at the end of memory where I want to write the data to. During stable operation I erase these pages, so that at last minute I just have to write the data.
The problem is that the actual program gets corrupted in the write protected pages.
Does write protection only affect external writing or also internal writing? In other words, is it a possibility that the write instructions leave the entire memory vulnerable for corruption even though I am not altering the write protection on the pages with program code in?
Solved! Go to Solution.
2024-09-09 04:08 AM
I mean, enable Brown-out reset in the Option bytes, when you first program the mcu.
It remains to be enabled, and upon power going down, holds the mcu in reset, preventing the programming hardware to fail, when supply voltage falls below the threshold where it stops working correctly.
JW
2024-09-09 02:28 AM
Enable Brown-out reset in the Option bytes.
JW
2024-09-09 03:22 AM
How would that affect the problem of the actual code getting corrupted. After code corruption with the final write the controller is unable to execute the program anymore.
2024-09-09 04:08 AM
I mean, enable Brown-out reset in the Option bytes, when you first program the mcu.
It remains to be enabled, and upon power going down, holds the mcu in reset, preventing the programming hardware to fail, when supply voltage falls below the threshold where it stops working correctly.
JW
2024-09-09 06:26 AM
Okay, I see what you are saying. Thanks, I will give it a try.