Quality RTOS & Embedded Software

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




Loading

Timer callback intrval accuracy

Posted by joe_her on October 25, 2016

I wonder what accuracy can I get for the intrvals of the timer callback routine. For example if I set it to 100 ms, System tick is 1ms, and the callback is short, how many ticks will it miss(if any)? Is it better, or is it the same as read system ticks and wait with taskDelayUntil() in a task loop (instead of using timer callback)? Thanks Johanan


Timer callback intrval accuracy

Posted by edwards3 on October 25, 2016

The accuracy is set by the tick frequency and the priority of the timer service task relative to other tasks.

All timing, including when a timer callback function is executed, is limited by the granularity of the configured tick frequency.For example if you block a task for 10 ticks and the task enters the blocked state immediately before a tick interrupt the time the task blocks for will be closer to 9 ticks than 10, maybe 9.05 ticks. If instead the task entered the block state immediately after a tick interrupt the time the task blocks for could be 9.999 ticks.


Timer callback intrval accuracy

Posted by joe_her on October 26, 2016

I can set normal task priority, but I don't see how to set a software timer priority that runs a call back function. So if I need a function that will run every 100 ms, and I can tolerate some +/- gittter on the interval, but would like that the average time will be as accurate as possible (that is after 1000 seconds it will run 10000 times), what is the best way to implement it? (softwre timer? waitUntil? or any other idea..)


Timer callback intrval accuracy

Posted by rtel on October 26, 2016

See http://www.freertos.org/RTOS-software-timer.html and in particular the description of configTIMERTASKPRIORITY on http://www.freertos.org/Configuring-a-real-time-RTOS-application-to-use-software-timers.html


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

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