Tickless Idle and Software Timer Issue

tarun-patel wrote on Monday, October 05, 2015:

I am using FreeRTOS 8.2.2. Same issue is present in FreeRTOS 8.2.1 as well.

Please find my project scenario below.

I am using Tickles Idle mode for extra power saving.

I have two tasks.
Task A creates a software timer (autoreload) using xTimerCreate call. This timer will expire at every 100 tick and call it callback function.
Task B will be called at every 2000 tick as I blocked it by vTaskDelay function.

Now, I am expecting controlller will be wakeup from Tickless Idle mode at every 100 tick and do its job.

However, as per my practical expriement, I am getting 100 tick xExpectedIdleTime most of the time. However, some times I am getting 2000 tick xExpectedIdleTime instead of 100 tick.

What will be the reason behind this?

Thanks,
Tarun

rtel wrote on Monday, October 05, 2015:

If the timer is auto reload then I would not expect a 2000 tick delay - could you please create an example project that demonstrates this behaviour and send it to me a r [dot] barry at FreeRTOS [dot] org. Make the project as small as possible so it doesn’t do anything else other than demonstrate this behaviour.

Also - which chip and compiler are you using, and are you using a tickless idle implementation provided by ourselves or one that you provided yourself. Finally, is the priority of the timer task set to (configMAX_PRIORITIES - 1)? If not, what is it set to?

Regards.

tarun-patel wrote on Monday, October 05, 2015:

Thanks for prompt response.

Yes timer is auto reload and that’s why I am getting 100 tick xExpectedIdleTime most of the time. I will create a demo project and email you by tomorrow.

I am using Toshiba’s TZ1001 (ARM Cortex M4F) chip and Keil uVision compiler (V5.05 update 2 (build 169)).
We have implemented tickles idle ourselves. I mistakenly taken timer task priotity to configMAX_PRIORITIES. I have corrected it to (configMAX_PRIORITIES - 1) that however problem is still exist.

Thanks,
Tarun

tarun-patel wrote on Thursday, October 08, 2015:

I have prepared a demo project. However, I am not able to reproduce this behaviour in that project. So I derived there is something in my project’s energy measurement library which creates this issue.

I have tried loads of workaround. However, when I enabled preemption using configUSE_PREEMPTION macro, the problem is resolved. I don’t know why.

Do you have any idea how this be possible? Meanwhile, I am digging my project for the reason.

Thanks,
Tarun

rtel wrote on Thursday, October 08, 2015:

I have tried loads of workaround. However, when I enabled preemption
using configUSE_PREEMPTION macro, the problem is resolved. I don’t know why.

I don’t think you mentioned you weren’t using pre-emption before. I
have never tried tickless idle without preemption before.