# How to choose best TICK\_RATE\_HZ?

**URL:** <https://forums.freertos.org/t/how-to-choose-best-tick-rate-hz/3041>\
**Category:** Kernel\
**Created:** [February 17, 2009, 3:56pm UTC](https://forums.freertos.org/t/how-to-choose-best-tick-rate-hz/3041 "2009-02-17T15:56:04Z")\
**Posts on this page:** 5\
**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:** [February 17, 2009, 3:56pm UTC](https://forums.freertos.org/t/how-to-choose-best-tick-rate-hz/3041/1 "2009-02-17T15:56:04Z")

</div>

**[willywortel](https://sourceforge.net/u/willywortel/)** wrote on [Tuesday, February 17, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/874de553/#87da):

Hi all (again),

In the documentation, it is stated that the default (1000hz) tick is higher than normally would be required.

What I notice is, that when i increase the tick count to 1050hz I never get a tick count.  
This happens only when there is a task available. When I just start the scheduler, i can get as high as 10.000  
without any problem. I get the tick count by using a trace macro on the PIC32.  
What is this about? The task that is running is the only task and has nothing in it (except a continuous loop).

But my main question is, what is the best (highest) tick count without (crashing) sooner or later the tick count?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 17, 2009, 4:00pm UTC](https://forums.freertos.org/t/how-to-choose-best-tick-rate-hz/3041/2 "2009-02-17T16:00:39Z")

</div>

**[willywortel](https://sourceforge.net/u/willywortel/)** wrote on [Tuesday, February 17, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/874de553/#87da/920e):

Sorry, had to add this text too.

And when I select a tick rate off 100, the task will run continuously. (Also measured using trace functions)

This is the tasks only function:

&nbsp;&nbsp;&nbsp; while(1){  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vTaskDelay(5 / portTICK\_RATE\_MS );  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp; }

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 17, 2009, 4:09pm UTC](https://forums.freertos.org/t/how-to-choose-best-tick-rate-hz/3041/3 "2009-02-17T16:09:15Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Tuesday, February 17, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/874de553/#87da/56ad):

portTICK\_RATE\_MS will be less than 0 if configTICK\_RATE\_HZ is greater than 1000. As its an integer it will probably be a divide by&nbsp; zero.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 17, 2009, 4:21pm UTC](https://forums.freertos.org/t/how-to-choose-best-tick-rate-hz/3041/4 "2009-02-17T16:21:54Z")

</div>

**[willywortel](https://sourceforge.net/u/willywortel/)** wrote on [Tuesday, February 17, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/874de553/#87da/56ad/348e):

I just found out so 🙂

Thank you very much!

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 17, 2009, 4:28pm UTC](https://forums.freertos.org/t/how-to-choose-best-tick-rate-hz/3041/5 "2009-02-17T16:28:13Z")

</div>

**[raphaelpereira](https://sourceforge.net/u/raphaelpereira/)** wrote on [Tuesday, February 17, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/874de553/#87da/56ad/348e/dd1a):

If you want, use the following macro for a generic greater than 1000 ticks converter:

#define rtos\_convert\_to\_ms(A)&nbsp; (((A \* 1000)/(1000000 / configTICK\_RATE\_HZ)))
