FreeRTOS tick rate

cancel
Showing results for 
Search instead for 
Did you mean: 

FreeRTOS tick rate

941 Views
songja
Contributor III

Hello,

Regarding the FreeRTOS tick rate, I found that "configTICK_RATE_HZ" is set to 200.

Is it possible to change the value up to 1000Hz so I can measure with sampling frequency of 1000Hz?

I attached the part of the code related to this.

---------------------------------------------------------------------------------------------------------------------------------------

#define ADC_SAMPLE_FREQ 1000U
#define mainQUEUE_SEND_PERIOD_MS (1000/(ADC_SAMPLE_FREQ*portTICK_PERIOD_MS))

#define mainSOFTWARE_TIMER_PERIOD_MS (1000 / portTICK_PERIOD_MS)
#define mainQUEUE_LENGTH (1)   

xExampleSoftwareTimer = xTimerCreate("LEDTimer", mainSOFTWARE_TIMER_PERIOD_MS, pdTRUE, (void *)0, vExampleTimerCallback);

xTimerStart(xExampleSoftwareTimer, 0);

static void vExampleTimerCallback(TimerHandle_t xTimer){

   ulCountOfTimerCallbackExecutions++;
}

vTaskDelayUntil(&xLastWakeTime, mainQUEUE_SEND_PERIOD_MS);

------------------------------------------------------------------------------------------------------------------------------------------

Thank you for your help.

Regards,

0 Kudos
2 Replies

648 Views
danielchen
NXP TechSupport
NXP TechSupport

HI JAEYONG

The systick rate can configured to 1000. Actually FreeRTOS doesn't impose a maximum tick rate. But it is advised not to go over 1k HZ, otherwise, too much time will be spent switching between tasks, and result in much overhead.

Regards

Daniel

0 Kudos

648 Views
songja
Contributor III

Thank you, Daniel.

I changed the value from 200 to 500 and sampling frequency to 500. Then I streamed the data on Putty and saved the printout data on the terminal.

Despite the change, the number of sampled data for 5 seconds was still 1000 which means the sampling frequency was still 200Hz. 

is there anything else that I am supposed to change other than "configTICK_RATE_HZ " in "FreeRTOSConfig.h"?

Regards,
Jay

0 Kudos