Reputation: 95
I use FreeRTOS on a EFM32GG380F1024. The Cortex-M SysTick is used for the RTOS tick. The low-energy RTC (BURTC) is used during sleep to generate timed wakeup calls. Energy Mode is EM3 (Just Ultra-Low-Frequency still operating).
As soon as FreeRTOS calls me with the suppressTicksAndSleep
callback, I do as follows:
__disable_irq()
.SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;
.The problem is that just after the energy mode entrance, the SysTick interrupt kicks in an wakes the device. This should not be possible because the Energy Mode 3 disables HF and LF clocks, so the Systick counter should not even increment.
Why is this not suspending the SysTick correctly?
NB: Below is a screenshot of my tracealyzer:
Upvotes: 1
Views: 4584
Reputation: 12620
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk
You are not clearing any bits in CTRL
. That line should probably be like
SysTick->CTRL &= ~(SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk)
to clear all bits for CLKSOURCE
and ENABLE
.
Upvotes: 5