FreeRTOS vTaskDelay different cpu frequency K22FX

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FreeRTOS vTaskDelay different cpu frequency K22FX

2,584 Views
ypkdani
Contributor III

Hello,

i have a K22FX with FreeRTOS. I use this cpu at different frequency (120Mhz,16Mhz, 4Mhz). For have a costant delay with this different setting what i have to do? 

In my function i use : 

vTaskDelay(100 / portTICK_RATE_MS); //100ms

for have a xxx ms of delay. 

portTICK_RATE_MS is defined as portTICK_PERIOD_MS

and

portTICK_PERIOD_MS  as ( ( TickType_t ) 1000 / configTICK_RATE_HZ )

where

configTICK_RATE_HZ ((TickType_t)1000)

It's right if i set configTICK_RATE_HZ as my CPU frequency in Hz?

Thanks

Labels (1)
Tags (3)
0 Kudos
Reply
2 Replies

1,863 Views
FreeRTOS_org
Contributor IV

[Luckily, every time I try and use this forum I have to reset my password.  Thought that had been fixed.  Gets a bit boring.]

I find your post confusing.  If you want to change the clock frequency, or just generally as good practice, you should specify times in milliseconds rather than ticks. For many years the preferred way of doing that is to specify times using the pdMS_TO_TICKS() macro.  Look it up on Google or in the free FreeRTOS book.

In all cases you have to set configCPU_CLOCK_HZ and configTICK_RATE_HZ correctly so the RTOS can set up the configuration you want.

0 Kudos
Reply

1,863 Views
ypkdani
Contributor III

Hello,

yes i need to generate some delay in ms but i don't understand how it generate the tick interrupt that increment this. My question is then what timer freertos use to generate the TICK_RATE? It use the System Tick Timer of the cpu or normaly use a software interrupt that increment a variable?

UPDATE: i have read that with ARM the freeRTOS use the System Tick Timer, so by default i have the configTICK_RATE_HZ set to 1000. If my CPU work at 120Mhz i have to set this variable at 120Mhz ... right? After that i can use the pdMS_TO_TICKS function to convert my delay in ms 

Thanks

0 Kudos
Reply