Using vTaskDelay with Tickless Idle

hirohiro wrote on Thursday, June 06, 2019:

I’m running into an issue where my tasks aren’t being scheduled after a vTaskDelay() call on a system using the tickless idle. When I configure the system timer to run off the external 32kHz oscillator everything works fine, however if I configure it to run off the internal RC vTaskDelay doesn’t seem to return. However, other tasks (without a vTaskDelay) are still running.

I’m fairly new to FreeRTOS and more so to the tickless idle so I’m wondering if there are any caveats to using vTaskDelay with tickless mode. If vTaskDelay is okay to use in this mode, how do I go about debugging this?

Working:
#define configSTIMER_CLOCK_HZ                     32768
#define configSTIMER_CLOCK                        AM_HAL_STIMER_XTAL_32KHZ

Not Working:
#define configSTIMER_CLOCK_HZ                     1000
#define configSTIMER_CLOCK                        AM_HAL_STIMER_LFRC_1KHZ
  • Hardware: Ambiq Apollo 3
  • IDE/Toolchain: Keil
  • FreeRTOS9

richarddamon wrote on Thursday, June 06, 2019:

The first question would be if you disable tickless idle, but just run your tick of the RC, does the tick count increase.

A second question (if the first is working) is does the sleep state being used disable the RC timer?

hirohiro wrote on Thursday, June 06, 2019:

Okay that was already helpful, I was able to find out that in my not working case, xTaskIncrementTick is never being called, while it is in the working case- I guess that’s expected.

  1. If I disable the tickless idle features, the tick is incremented and my application is once again working.

  2. According to the datasheet the LFRC is always running.

I think this gives me a bit more of an idea of which direction to look but any more suggestions are welcome. Thanks!