Quality RTOS & Embedded Software

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




Loading

Configure "configTICK_RATE_HZ"

Posted by Anuradha on September 1, 2011
All,

I am using FreeRTOS with STM32L.

Currently I have configured "configTICK_RATE_HZ" parameter in FreeRTOSConfig.h to be 1000.
I want to change this parameter to 250.

There are vTaskDelay()s and xTicksToWait defined in my code.
Is it possible to achieve the same delay miliseconds I achieved with Tick rate 1000 in Tick rate 250,
without changing the figures i used at vTaskDelay()s and xTicksToWaits?

Thank you.
Anuradha

RE: Configure "configTICK_RATE_HZ"

Posted by Richard Damon on September 1, 2011
If you wrote the delays as plain numbers, no. The key to making these delays "constant" over varying tick rates is to compute the value based on configTICK_RATE_HZ like vTaskDelay(delayms * configTICK_RATE_HZ/1000)

I tend to define a macro to do the conversion and use it on all delays that are specified in ticks, so that I can specify them in ms and not need to worry if I adjust the tick rate.

There is one hack you could do if this is too much work to do it right, and that is change the tick interrupt to call the tick increment routine 4 times.

RE: Configure "configTICK_RATE_HZ"

Posted by Mike on September 1, 2011
If these are defined in terms of portTICK_RATE_MS, defined in portmacro.h, then timings will still be correct.

If not they won't, but it should be worth changing the definitions from (say) counts (in ticks) to delay_ms / portTICK_RATE_MS. If these are all constants, the compiler will work them out.

Regards

RE: Configure "configTICK_RATE_HZ"

Posted by Richard on September 1, 2011
Provided you keep configTICK_RATE_HZ at or below 1000, you can defined delays in milliseconds using:

5000 / portTICK_RATE_MS (for 5 seconds)
250 / portTICK_RATE_MS (for 250 milliseconds)
etc.

Then changing configTICK_RATE_HZ will not effect the delay period as portTICK_RATE_MS will be adjusted automatically.

There are lots and lots and lots of examples of this in the set of standard demo tasks that are used in all the demo applications included in the FreeRTOS download.

Regards.

RE: Configure "configTICK_RATE_HZ"

Posted by Richard on September 1, 2011
Everybody answered at once ;o)

RE: Configure "configTICK_RATE_HZ"

Posted by Anuradha on September 2, 2011
All,

Thanks for replying.


[ 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