Found a bug in the Hardware timerserver source file for STM32WPAN Middleware. If RestartWakeupCounter function is past a zero value in its "Value" parameter, then the function will complete without re-enabling the RTC_WAKEUPTIMER.
The case described occurs when multiple timers are used and one repetitive timer is tiggered right after another repetitive timer. The first code snippet below shows the current implementation and the second shows the fixed code.
static void RestartWakeupCounter(uint16_t Value)
{
/**
* The wakeuptimer has been disabled in the calling function to reduce the time to poll the WUTWF
* FLAG when the new value will have to be written
* __HAL_RTC_WAKEUPTIMER_DISABLE(phrtc);
*/
if(Value == 0)
{
SSRValueOnLastSetup = ReadRtcSsrValue();
/**
* Simulate that the Timer expired
*/
HAL_NVIC_SetPendingIRQ(CFG_HW_TS_RTC_WAKEUP_HANDLER_ID);
}
elseThe line containing "__HAL_RTC_WAKEUPTIMER_ENABLE(phrtc);" must be added to the above code to fix the bug as shown in the code below.
static void RestartWakeupCounter(uint16_t Value)
{
/**
* The wakeuptimer has been disabled in the calling function to reduce the time to poll the WUTWF
* FLAG when the new value will have to be written
* __HAL_RTC_WAKEUPTIMER_DISABLE(phrtc);
*/
if(Value == 0)
{
SSRValueOnLastSetup = ReadRtcSsrValue();
/**
* Simulate that the Timer expired
*/
HAL_NVIC_SetPendingIRQ(CFG_HW_TS_RTC_WAKEUP_HANDLER_ID);
__HAL_RTC_WAKEUPTIMER_ENABLE(phrtc); /**< Enable the Wakeup Timer */
}
else
...