Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


vTaskDelay() problem

Posted 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() problem

Posted 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)

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner