Quality RTOS & Embedded Software

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


How the jitters adjust the task tick count?

Posted by Bill Yang on April 15, 2009

In FreeRTOS demo, it uses a high frequency timer to measure the jitters. If a timer set up its clock_time() with return xTaskGetTickCount(), what do the jitters effects the task tick count or how to adjust the task tick counts with jitters? I wonder if someone can contribute any idea regarding my question.

thanks, bill yang

RE: How the jitters adjust the task tick coun

Posted by Richard on April 15, 2009
I'm not sure what your question is. The xTaskGetTickCount() function can only return a tick count with the resolution of the tick frequency. This tick count will not suffer from an accumulating error over time - unless you are leaving interrupts disabled for a period greater than one tick period. If you want a higher resolution timer then you can use a different peripheral timer in the same way that the demo does.


RE: How the jitters adjust the task tick count?

Posted by Bill Yang on April 15, 2009
I am Sorry, Richard. I did not clear state my question. The reason I ask this question because I am using a Linux version program in my project. The Linux program has a timer and uses jiffies to adjust the timer when it resets. My project also needs a timer, but it used the task tick counts by returning value from xTaskGetTickCount(). Since the FreeRTOS demo can measure the jitters from a high frequency timer, Question1: Do I have to use the jitters to adjust my timer? Question 2: If it needs to adjust timer by the jitters, how to covert the jitters to a task tick count? Note: jitters are counted in ns (1/1000000000) and task ticks are counted in ms. So the time of jitters used can be computed by;
time = (jitters * 1/1000000000) / ((1/configTICK_RATE_HZ) * 1000000)
If I am wrong, what is your suggestion?

Regards, Bill

RE: How the jitters adjust the task tick count?

Posted by incrediball on April 15, 2009
Can the FreeRTOS demo measure the jitters from a high frequency timer? I'd be very surprised if it can.

As far as I understand, jitter does not accumulate and does not affect the overall average frequency. The only factor affecting clock frequency is the crystal's accuracy and is expressed in PPM, which you want to be as low as possible.

RE: How the jitters adjust the task tick coun

Posted by Richard on April 15, 2009
Some of the Cortex M3 and also I think PIC32 demos include a 20KHz interrupt that is assigned a priority above any interrupt priority used by the kernel. The priority is also above the priority that gets masked within critical sections. The idea is to demonstrate that interrupt service routines can be defined to perform functions that require very accurate timing. The priority assignment being above that masked by critical sections and above the kernel interrupt priority means the 20KHz interrupt should never get delayed or otherwise effected by something the kernel is doing. To prove this the 20KHz ISR just measures the time between its invocations to calculate the jitter - it uses a timer peripheral that is running at a fast rate to take a measurement in nano seconds.

I have probably managed to make that sound much more complex than it actually is, but the important thing to note is that the jitter being measured is the jitter in the 20KHz interrupt NOT the jitter in the RTOS tick interrupt. No adjustment in the RTOS tick is needed unless the application is doing something that means the tick interrupt cannot execute for a period greater than one tick.

Again I think I made that second bit sound more complex than it actually is - its been a long day!


RE: Thanks.

Posted by Bill Yang on April 15, 2009
Thanks Richard, I got it.

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

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

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo & Nuvoton Cortex-M23 demo.

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

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

Cadence Tensilica Cortes

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