1
\$\begingroup\$

There are a number of possible causes for a microcontroller to reset itself, for example:

  • brown-out or power-out

  • watchdog timer

  • reset initiated from software (to programmatically enter bootloader, etc)

I'm wondering if there is a way to figure out, when a microcontroller starts up, what was the reason for the last reset - perhaps using some kind of flags that survive reset. In particular I'm on the MSP430F5xxx series.

The use case is to avoid a cycle where some part of the self-test routine (for example) causes a glitch on the power rail, and then the micro resets itself and runs the self test again, repeat (until it succeeds).

\$\endgroup\$

1 Answer 1

5
\$\begingroup\$

You can get the reset source from checking the system reset interrupt vector (SYSRSTIV), there is a good description on the TI wiki (Handling MSP430 System Reset Events).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.