Replacing vTaskDelay(); in Renesas RZ/A1H MCU

Hi RTOSians,

Could anyone suggest replacing the use of vTaskDelay(); in effective manner.
And how to handle those with new one.
I’m currently using APIs for Renesas RZ/A1H.

I really appreciate your help.

Thanks,
Rakshith

your question does not make any sense whatsover. Why would you want to replace the call and for what purpose?

Thanks for your time in replying.

There are a few potential reasons why I planned replacing vTaskDelay() in FreeRTOS.

  1. As vTaskDelay() works in ticks, which may not provide fine-grained enough control for some applications. More precise timing might be needed.
  2. In some cases, vTaskDelay() can lead to busy-waiting, which isn’t ideal for CPU utilization.
    There are some other issues could be generated.
    Any recommended alternatives if any please.

Regards,
Rakshith

FreeRTOS and thus the scheduler works in ticks. You can not achieve finer granularity than ticks.

Also, in which cases do you think vTaskDelay ends up in busy waiting?

It may be possible to come up with something that uses an isr and the portYieldFromISR mechanism to force the scheduler to schedule your task in between timer ticks, but I would think that these techniques are rather error prone and not guaranteed to always meeting strict timing requirements.

It is quite easy to get the scheduler to change tasks between timer ticks. That is the whole purpose of the “wasWoken” flag in the FromISR functions.

Sub-tick delays (or delays more accurate then up to -1 tick) can easily use a hardware time that sends a notification or gives a semaphore.

That was my point in my latest post, but it is still subject to the scheduling rules; for example, if the task to be woken outside of tick granularity does not have the highest priority, its wake deadline will not be met. That is why the TO should not expect reliable fine granularity scheduling unless his architecture centers around this.

This is not correct. vTaskDelay puts a task in the blocked state and ensures that it is not picked by the scheduler until the time passed to vTaskDelay expires.