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


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