This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR2355: re-initializing variables in application ?

Part Number: MSP430FR2355


I have global variables defined outside of main....Within main I run a certain block of code and then 

WDCTL = 0xDEAD;

which resets the part.  I can see all my configuration getting done HOWEVER I noticed that global variables were NOT being re-initialized to there former settings.  How do I do this?

for instance I have a global defined as:

volatile boolean transmitter = F;

after running code this get's set to T, I expected that the incorrect password to the watchdog would reset to the beginning of main (which it did) and reset all the variables to their initial values?

  • Variables are initialized by C runtime library code that should run after reset. I suppose the library could check and only do that for some kinds of resets but I have never heard of such a thing.

  • Hey Steve,

    Did you ever get this worked out?  Was this happening during debugging?  

    Trying to debugging through resets and LPMx.5 modes can be a bit different.  while debugging, the debugger is actively engaged with the CPU core.  This means that certain timings and actions can behave differently while debugging and without.  

    You can try "Free running" you device which will allow the CPU to operate normally but also ignores all breakpoints.  You could free-run, go through your routine and catch your self in a loop, then pause and check.  

    Hope this helps.

    JD

**Attention** This is a public forum