Flash write/read issue
Posted: Sat Apr 13, 2024 8:55 am
Hi,
I have been banging my head over the following.
I have setup some functions to read and write to Flash which seem to work fine. But when I try to check the values of a global variable in flash compared to another global variable in RAM I have a problem. Before I even set the flash variable it is already updated.
In detail. The following code is run at boot once.
Global variables are set
uint8_t Test2;
uint8_t gg; The result is this. Which is ok since Test2 has a value of 48 in flash from before. Now if I remove the comment on //Test2=gg;
I get the this. Test2 has become =gg=50 without even reaching at this part of the code yet !! It's like it has been updated by magic! This happens all the time whatever value gg has, Test2 has already been updated with it !
I have been banging my head over the following.
I have setup some functions to read and write to Flash which seem to work fine. But when I try to check the values of a global variable in flash compared to another global variable in RAM I have a problem. Before I even set the flash variable it is already updated.
In detail. The following code is run at boot once.
Global variables are set
uint8_t Test2;
uint8_t gg; The result is this. Which is ok since Test2 has a value of 48 in flash from before. Now if I remove the comment on //Test2=gg;
I get the this. Test2 has become =gg=50 without even reaching at this part of the code yet !! It's like it has been updated by magic! This happens all the time whatever value gg has, Test2 has already been updated with it !