cancel
Showing results for 
Search instead for 
Did you mean: 

Recovering information after software reset

Peter Mather
Associate III
Posted on June 14, 2018 at 16:39

My program executes a software reset under certain conditions using  'NVIC_SystemReset();'

Before executing the reset I need to set a variable that will still be accessible after the reset so the program can understand the cause and take appropriate action. On a PIC I do this by using a special variable  '_excep_code'.

How can I do the same thing on the  STM32.

Developing on Nucleo-H743, Software Workbench for STM32

3 REPLIES 3
Posted on June 14, 2018 at 17:41

In linker script, set up a section in RAM, which is not going to be cleared by the startup code.

This has been discussed here several times, try to search.

JW

Jack Peacock_2
Senior III
Posted on June 14, 2018 at 20:15

An alternative to linker sections is to use the backup registers in the RTC.  As long as you have backup domain power it's preserved, plus there's some parasitic write protection during the reset cycle.

  Jack Peacock

Posted on June 14, 2018 at 23:32

And an alternative to backup registers in RTC there's the backup RAM, if implemented in given model of STM32... ;)

JW