FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [June 2011 Threads] vTaskDelay() problemPosted by Anu123 on June 13, 2011 Hello all, vTaskDelay(x) function provided by FreeRTOS, Delay a task for a given number of ticks here x. If my tick count is 1ms the minimum delay i can obtain is 1ms.
Does FreeRTOS provide a way in which i can achieve a delay lesser than 1ms, without changing the current tick rate?
Thank you..
RE: vTaskDelay() problemPosted by Richard Damon on June 13, 2011 No, not directly. If you think about it, how would FreeRTOS know when the time expired?
There are a couple of ways to generate short waits: 1) If it is really shorts, just enter a short spin wait loop, (just make sure your complier doesn't optimize it out) 2) For longer delays, but needing better than 1 tick accuracy, set up a high speed one shot timer (if your processor has one), and program it to interrupt in the given time delay. Program the interrupt to give a semaphore. To delay, fire off the delay and wait for the semaphore.
Note that I say "1 tick accuracy" as the built-in FreeRTOS delay has that level of inaccuracy. If you ask for a 1 tick delay at a 1 ms tick, you will get somewhere between 0ms and 1ms, if you ask for a 2 tick delay, you will get a delay between 1ms and 2ms. The low end of the range happens if you are at the end of a tick, and just after you call the delay function the tick occurs. Delays of course can also b extended if other tasks at your priority or higher become ready during the delay, as the delay just affect when this task is eligible to get CPU time, not when it will (unless it is the highest priority task)
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|