cancel
Showing results for 
Search instead for 
Did you mean: 

WB55 Systick Sometimes Doesn't work

TWood.4
Associate III

Our Project uses the STM32WB55 with FreeRTOS, using the Systick to context switch. We use both IWDG and WWDG.

To power down the unit we set a flag in non-volatile RAM and then force a WWDG reset. At reset, the NV RAM is checked and if it indicates a power-down request we use the following code to put the unit to sleep:

 

// And Stop

UTIL_LPM_SetStopMode(1U << CFG_LPM_APP_BLE, UTIL_LPM_ENABLE);

UTIL_LPM_SetOffMode(1U << CFG_LPM_APP_BLE, UTIL_LPM_DISABLE);

__HAL_RCC_WAKEUPSTOP_CLK_CONFIG(LL_RCC_STOP_WAKEUPCLOCK_HSI);

STO();

UTIL_LPM_EnterLowPower(); // Sleep Here

 

NVIC_SystemReset();

 

So at wake-up the unit always restarts with a software reset.

We use the ST Class B Safety Libraries, so each reset tests both Watchdogs.

Sometimes (maybe one time in ten) when we come to run FreeRTOS there is no Systick Interrupt.

Other interrupts continue to run, TICKINT and ENABLE are set in the Systick Configuration and the

Systick counter is visibly counting down. COUNTFLAG is set showing that the Systick

should have generated at least one interrupt.

I'm not totally clear about how the NVIC works but Bit 15 (systick) is cleared in ISER0, ICER0 and ISPR0.

Not sure which register contains the priority but I'm setting it to 15.

 

A very important detail is that resetting does not fix this problem - it requires a chip power down.

 

1 REPLY 1
Saket_Om
ST Employee

Hello @TWood.4 

 

You need to suspend the systick interrupt before entering in stop or sleep mode. And resume it after wakeup.

 

 

    HAL_SuspendTick();
    HAL_PWR_EnterSLEEPMode(PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFI);
    HAL_ResumeTick();

 

 

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar