Issues Using tickless idle on SIlicon labs chips with new power manager

I am leaving this here as a pointer for others who might fall into the same trap. Please move it if necessary:

The silicon labs FreeRtos demos linked in the docs are outdated, as they use their old deprecated sleep driver and not the new power manager implementation from the latest SDKs.

There is a newer implementation for FreeRtos hidden in the Z-Wave SDK, that uses a file called tick_power_manager.c to handle the tickless idle low-energy sleeping. We went ahead and used that file for our application. however unfortunately this file has a bug as described in their release notes here (known issues section 1247775): https://www.silabs.com/documents/public/release-notes/SRN14930-7.22.0.0.pdf

The RTOS tick can stop when the
application requires frequent
interruptions. The RTOS tick is then
not incremented and stops the Z-
Wave stack and other tasks.

Workaround

In the sli_schedule_wakeup_timer_expire_handler() function, replace
/* Increment the RTOS tick. */
while ((current_tick_count - last_update_lftick) >
lfticks_per_os_ticks) {
sched |= xTaskIncrementTick();
last_update_lftick+= lfticks_per_os_ticks;
}
By
/* Increment the RTOS tick. */
while ((current_tick_count - last_update_lftick)
>= lfticks_per_os_ticks) {
sched |= xTaskIncrementTick();
last_update_lftick+= lfticks_per_os_ticks;
}

I hope the next person running into this issue finds this and doesn’t have to waste a month of their life

2 Likes

Thank you for sharing!