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




Loading

RTOS tick rate vs thread frequency.

Posted by rogue-ant on May 29, 2015

Hi, I'm trying to determine a proper tick rate for the RTOS kernel...

I have two tasks which need to iterate periodically. The first task needs to run every 1mS; the second task needs to run every 6mS. I cannot set either to run from a dedicated timer ISR - they both must be controlled by the RTOS.

Processor is an ARM @ 300MHz.

I understand the RTOS can tick at frequencies greater than 1kHz. But I am wanting the minimal RTOS overhead possible, while still achieving my timing needs...

Would 1KHz work? That would require the RTOS to kick-off the 1mS loop every iteration - but what about the 6mS loop then? If >1kHz is needed, I understand that it needs to be an even multiple, which gives a (partial) option of 0.5mS, 0.25mS, 0.1mS ticks.

What is the ideal tick time for my requirements?

Thanks,

-Joshua


RTOS tick rate vs thread frequency.

Posted by rogue-ant on May 29, 2015

So, informal testing, it looks like I can set the RTOS tick to 1mS - the same as my fastest loop and it will still iterate both threads properly...


RTOS tick rate vs thread frequency.

Posted by richard_damon on May 30, 2015

Yes, it should. One way to look at it, assuming that you have preemption enabled, and the 1ms task is given the higher priority (and no higher priority interferes)

Assuming we start at a tick where both tasks should run:

Tick interrupt occurs and both 1ms and 6 ms tasks are marked as ready.

First the 1ms task runs (since it has the higher priority), until it completes (or blocks for something else), and then waits for the next timer tick to occur (next 1ms chunk).

Then the scheduler will start the 6ms task which is also ready. If it finishes before the next timer tick it can just delay till the next 6ms time mark. If it hasn't finished, then on the timer tick the 1ms task will preempt the operation and run, returning to the 6ms task when it finishes. The 6ms task should use xTaskDelayUntil if you want the 6ms to be measured from when the task was first marked ready as opposed to when it finishes.


RTOS tick rate vs thread frequency.

Posted by rogue-ant on June 1, 2015

Richard, thanks for taking the time to answer!


[ 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