FreeRTOS tick length

Hello,

I have been using FreeRTOS V10.1.1 port for Zynq 7000 and I have been attempting to find out how long does it take one FreeRTOS tick.

I have found that the FreeRTOS uses the SCU timer as a time base. I have also find that the load register of the SCU timer is loaded with value SCUTIMER_CLOCK_HZ/configTICK_RATE_HZ in the FreeRTOS_SetupTickInterrupt. Based on the values of the symbolic constants it seems to me that the load register contains 3 333 333,435. I would need to know the frequency of the clock signal used by the SCU timer to be able to determine the tick period but I have lost in the clock settings. I know that the PS part uses clock signal with frequency 33,3333 MHz but I am not able to find out what is the frequency of the clock signal used by the SCU timer.

Does anybody know how to determine the frequency of the clock signal used by the SCU timer?

I presume that will be dependent on your hardware and software initialisation - can you look at the hardware description to get that information? Or look at the code that configures the SCU timer?

It is not clear what you want to measure - the time between ticks is set by configTICK_RATE_HZ in FreeRTOSConfig.h, to set that correctly you need to know the frequency of the timer used to generate the tick interrupt - maybe that is why you are trying to work that out but it would normally be known by the hardware designer and firmware engineers in that you should set it to what you need rather than try to work out what it actually is?

I’m quite familiar with the Zynq port of FreeRTOS. The SCUTimer frequency is configured in the PS block settings, but you don’t need to bother with that if you’re using a pre-done example. SCUTIMER_CLOCK_HZ is already set to the frequency of the SCU Timer - so just see what that define is equal to. Unless you’ve created your own platform and FPGA bitstream, then that #define is correctly associated.

Hello Pilot, thank you for your reaction. I have found the symbolic constant XSCUTIMER_CLOCK_HZ which value is in my case XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ/2UL = 666666687/2 = 333 333 343 Hz. It seems that the SCU timer uses clock signal with 100 times higher frequency than is the frequency of the clock signal used by the PS.

Yep, 333Mhz is what the SCU Timer is set to in a lot of Zynq examples. It’s not really a multiple of anything - it’s 1/2 of the PS CPU Clock Frequency.

Most of the Zynq examples have the CPU running at 666Mhz and the SCU running at 333Mhz. Generally this is all PLL derived from a 33Mhz crystal.

The tick is then some fraction of the SCU timer. Most of the FreeRTOS Demos have the tick configured to be 1000 Hz.