This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to change FreeRTOS initial tick count ?

Hello,

I am using the NRF52840 with FreeRTOS and I would like to start the FreeRTOS tick count at a high value for testing purpose.

I have modified the  configINITIAL_TICK_COUNT value in the FreeRTOS.h file with a high value : 0xffffffff  - 0x1e000 = 0xfffe1fff

(0xffffffff correspond to the maximal tick count, TickType_t beeing a uint32_t value)

(0x1e000 = 2*60*1024 is for 2 minuts, configTICK_TATE_HZ value beeing at 1024)

It should start FreeRTOS tick count at 0xfffe1fff and go back to the zero value after 2 minuts (acctually this is what I want to test), but I have an unexpected result when I use the xTaskGetTickCount() function to see the tick count value (now is the value returned by the xTaskGetTickCount function) :

(FreeTROS.h) #define configINITIAL_TICK_COUNT 0

(LOG) now=4000 (4000 = 3*1024 = 3 sec)

--

(FreeTROS.h) #define configINITIAL_TICK_COUNT 0xfffe1fff

now=3119

I wonld expect the now value to be mutch higer than 4000 (about 0xfffe1fff = 4294844415)

Does anyone know where my problem comes frone ?

Thanks a lot,

Clément

Parents
  • This is purely FreeRTOS initialization code. The value you mentioned in configINITIAL_TICK_COUNT  is directly initialized to below in task.c

    PRIVILEGED_DATA static volatile TickType_t xTickCount 				= ( TickType_t ) configINITIAL_TICK_COUNT;

    The device specific port changes never resets xTickCount, so i am not sure why you are seeing this behavior. 

    It would be interesting to know where exactly you are printing these logs? and the code snippets on how you print them.

Reply
  • This is purely FreeRTOS initialization code. The value you mentioned in configINITIAL_TICK_COUNT  is directly initialized to below in task.c

    PRIVILEGED_DATA static volatile TickType_t xTickCount 				= ( TickType_t ) configINITIAL_TICK_COUNT;

    The device specific port changes never resets xTickCount, so i am not sure why you are seeing this behavior. 

    It would be interesting to know where exactly you are printing these logs? and the code snippets on how you print them.

Children
No Data
Related