I have a problem with my new board architecture based on SAMD21J18A.
The FW works properly but after some days it completely stop running.
I've also implemented a WDT based reset which occurs after 1 hour if the code is stuck, but it doesn't help in this situation.
If I look at the log, the code stop randomly and not in a particular point.
Basically in the FW's loop code does some actions every 4 seconds and it returns to sleep.
I think there is something missing in my sleep function. Could you please check it?
end_debug(); //stop serial.print()
// Don't fully power down flash when in sleep
NVMCTRL->CTRLB.bit.SLEEPPRM = NVMCTRL_CTRLB_SLEEPPRM_DISABLED_Val;
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
__DSB(); // Data sync to ensure outgoing memory accesses complete
__WFI(); // Wait for interrupt (places device in sleep mode)
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
start_debug(); ////start serial.print()
Is that the problem or there is something related to current spikes or what?