Thank you.There are tricks that you can play.
About the best it to detect the power to the uC dropping and save the data as the power goes down.
If the saved value does not need to be exact you update the saved value only when it is too different then the actual value.
Depends on the nature of the data.
The rate at which the power drops is slow compared to how fast the uC runs. You only need 600uS to write your data. I am not sure what devices it pays to turn off. You have to check the datasheet and experiment with that.I'm worried about saving data into non volatile memory every 30 sec, because it will get wasted after short time.
I can try it, but it seems to unreasonable that in such a short time i'll be able to turn off all power consumers GPIOs and peripherals and write to flash.
It seems unacheivable.
I do not know you compiler or chip, but I think you have it. If you use the const modifer there is a very good chance the array will be located in flash (this is compiler dependant). It is easier to let the compiler/linker figure out where to place the array. You could use the linker to setup a specific location in flash but do not fuss with that yet.Thanks for the effort!
You mean that if i want to write to lets say 1KB of flash, then i need to allocate an array of 1KB size and have it mapped to the flash 1KB memory space that i want to write to?
Could you please explain about "make sure the compiler puts it into flash"?