# Configure "configTICK\_RATE\_HZ"

**URL:** <https://forums.freertos.org/t/configure-configtick-rate-hz/3569>\
**Category:** Kernel\
**Created:** [September 1, 2011, 11:30am UTC](https://forums.freertos.org/t/configure-configtick-rate-hz/3569 "2011-09-01T11:30:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 1, 2011, 11:30am UTC](https://forums.freertos.org/t/configure-configtick-rate-hz/3569/1 "2011-09-01T11:30:18Z")

</div>

**[anuradha123](https://sourceforge.net/u/anuradha123/)** wrote on [Thursday, September 01, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/a1ef3a33/#7764):

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&nbsp; 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&nbsp; xTicksToWaits?

Thank you.  
Anuradha

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [September 1, 2011, 12:33pm UTC](https://forums.freertos.org/t/configure-configtick-rate-hz/3569/2 "2011-09-01T12:33:06Z")

</div>

**[richard\_damon](https://sourceforge.net/u/richard_damon/)** wrote on [Thursday, September 01, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/a1ef3a33/#848e):

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&nbsp;&nbsp;&nbsp; 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.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 1, 2011, 12:34pm UTC](https://forums.freertos.org/t/configure-configtick-rate-hz/3569/3 "2011-09-01T12:34:54Z")

</div>

**[mikehitekp](https://sourceforge.net/u/mikehitekp/)** wrote on [Thursday, September 01, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/a1ef3a33/#f31c):

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

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [September 1, 2011, 12:36pm UTC](https://forums.freertos.org/t/configure-configtick-rate-hz/3569/4 "2011-09-01T12:36:09Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, September 01, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/a1ef3a33/#a580):

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.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [September 1, 2011, 12:40pm UTC](https://forums.freertos.org/t/configure-configtick-rate-hz/3569/5 "2011-09-01T12:40:22Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, September 01, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/a1ef3a33/#74f6):

Everybody answered at once ;o)

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 2, 2011, 6:52am UTC](https://forums.freertos.org/t/configure-configtick-rate-hz/3569/6 "2011-09-02T06:52:34Z")

</div>

**[anuradha123](https://sourceforge.net/u/anuradha123/)** wrote on [Friday, September 02, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/a1ef3a33/#a361):

All,

Thanks for replying.
