Don’t worry my friend, you are really helping me in the issue, even if I do not see the links.
I was putting the MCU in low power mode using the PCM_setPowerState()
. Now I understand the situation better :D. The xMaximumPossibleSuppressedTicks
is very low, 349 ticks. Instead of put MCU in low power mode I used vPortSuppressTicksAndSleep()
in a wrapper function [CODE1]. It is working, but I’d like to put the microcontroller in a non-working state.
I saw the link that you sent and the Low Power RTOS For ARM Cortex-M MCUs
material, but I’m bit confused whether I can configure two SysTick sources. Is it possible to use two SysTick sources? One used when the MCU needs more power and another when the hibernate mode is required.
I appreciate your help.
void hibernate(uint8t time
int clockFrequency = 48000000; //48MHz
int tickRateHZ = 1000; //1KHz
int timerCountsForOneTick = (clockFrequency / tickRateHZ); // 48000 - timer for one tick 20,8ms
int maximumPossibleSuppressedTicks = portMAX_24_BIT_NUMBER
/ timerCountsForOneTick 349 ticks;
int iterations = time_ms / maximumPossibleSuppressedTicks;
int i = 0;
for (i = 0; i < iterations; i++)
vPortSuppressTicksAndSleep(maximumPossibleSuppressedTicks); // loop to complete the time