Skip to content

Commit 892594a

Browse files
sslupskyfacchinm
authored andcommitted
Fix SysTick timer lockup when waking from sleep (#17)
* fix SysTick timer lockup when waking from sleep
1 parent 4caff77 commit 892594a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/samd/ArduinoLowPower.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ void ArduinoLowPowerClass::sleep() {
2323
USBDevice.detach();
2424
restoreUSBDevice = true;
2525
}
26+
// Disable systick interrupt: See https://www.avrfreaks.net/forum/samd21-samd21e16b-sporadically-locks-and-does-not-wake-standby-sleep-mode
27+
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
2628
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
2729
__DSB();
2830
__WFI();
31+
// Enable systick interrupt
32+
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
2933
if (restoreUSBDevice) {
3034
USBDevice.attach();
3135
}

0 commit comments

Comments
 (0)