Hi,
I have the following code to reset my SAMD21. That also works very often. Only sometimes nothing happens and the SAMD21 continues to run. Do I have to pay attention to something else?
// Disable all interrupts
__disable_irq();
NVIC_SystemReset();
while (true);
If your using the RTC, to put the SAMD21 to sleep for example, then this might be a factor since the RTC is only reset by power-on reset.
Upon start-up it's possible to determine the cause of the reset, either power-on, external, or system (software) by reading the Power Manager's RCAUSE register:
if (PM->RCAUSE.bit.SYST) // Check if a system (software) reset has occured?
{}
Might I ask how you're detecting whether the microcontroller continues to run or resets?
Hi Martin,
I just want to make sure my MCU resets safely. I don't even want to know why afterwards. But you gave me another idea: I didn't even know that the SAMD had a clock! I wanted to build a clock module for it. I can save that now. And there is even a nice lib for it: