How can I get FreeRTOS kernel system timer frequency?

I my project , I want to get frequency of the system timer in hertz. Does anyone know?

Thanks a lot.

You describe the frequency of the chip you are running on using configCPU_CLOCK_HZ in FreeRTOSCofnig.h, and the tick interrupt frequency using configTICK_RATE_HZ. From your other post it looks like you are using CMSIS - in which case there is global variable that holds the CPU frequency - although it has to be set manually at boot time by the CMSIS initialisation function.

Thanks a lot for your quick response.
In my project for unknow reason configCPU_CLOCK_HZ is undefined on purpose. So I want to know another way to get kernel system timer frequency.


As explained by Richard the system timer or ticker frequency is defined by configTICK_RATE_HZ and mandatory.

For most processors, for the software to know what speed it is running at, it needs to be told. There is no general way to figure out the speed the CPU is clocked at, and if you don’t know that, FreeRTOS can’t figure out how to configure the tick timer to give the correct tick rate.

Some processors might have a second clock generator that runs at a fixed or reasonably fixed frequency (perhaps a 32768 Hz clock for RTC operation). In some cases it is possible to use a timer in the system to measure the speed of the main system clock with that known slower clock, and thus determine your system clock rate, but that is VERY system specific.