Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


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 ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists