We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Does anyone know wether the internal RAM contents of the STM32-microcontroller changes during a soft-reset respective a power on reset? It would be useful to know for sure that (for example) the RAM content will be reliable safe during a soft-reset and that the RAM will be erased by a power-on reset. Is anyone out there knowing something about the reset-behavior? Thank You very much in advance!
The SRAM is NOT erased at power up, it contains random/undefined content. The SRAM will retain across an NRST (external, or internal), so strategically placed values will remain. The Keil C startup code will clear/copy static regions defined by your code load, the startup code can be further modified to clear/set the rest/entire/portions of memory as required/desired.
There is a 4KB portion of NVRAM as I recall in the RTC/BKP domain which can be cleared by the TAMPER pin.
If you want to pass parameters across a reset, I would suggest building a structure in which to place them, with a signature, and a checksum, this way you can validate and manage it more cleanly.
It's easy to change the project settings and make the RAM a couple of kB smaller. Then the last kB of the RAM will not be cleared by the startup code.
This memory can then be accessed by a pointer - possibly to a suitable struct.
And as noted - keep a good checksum on this data to differentiate between garbage from a cold power-on (or a crashing/trashing run) and valid data from a previous run.