configTICK_RATE_HZ modify

michaelchiu wrote on Tuesday, January 31, 2012:

I’m trying to turn off the HOCO of RX210, and just use LOCO (@125k Hz) for system clock now.
Due to the low system clock, I also modify the value of “configTICK_RATE_HZ” to 100 (1000 is default).

1.Does it right action to modify the value of configTICK_RATE_HZ in FreeRTOSConfig.h? Because I find if it’s too high will cause system works very slow.
2.Does there had any known side effect when configTICK_RATE_HZ become lower?

rtel wrote on Tuesday, January 31, 2012:

A few comments:

1) 125KHz is an extremely slow frequency at which to run a fully active system.  125KHz is, I imagine, ideal for use while in a power saving mode.  If you system is fully active (performing is primary function, rather than doing background tasks while saving power) then using such a slow clock will make things like interrupt take a long time to execute - so you would be right to lower the tick frequency.  Most applications would reduce the tick frequency as 1KHz is not optimal for most applications.  Just keep in mind that you are running the system at a very small fraction of its maximum clock rate, so things will be much much slower to execute.

2) Have you told the FreeRTOS scheduler that the clock is so much slower?  On the RX200 there are two settings, configCPU_CLOCK_HZ and configPERIPHERAL_CLOCK_HZ, these are both in FreeRTOSConfig.h and, by default, map to the ICLK_FREQUENCY and PCLK_FREQUENCY settings in rskrx210def.h.  It is likely that the timer used to generate the tick interrupt is using the configPERIPHERAL_CLOCK_HZ setting (it is by default), so if that value is wrong then everything will be wrong. 

3) The side effect of having a slower tick frequency is lower timing resolution.  Ticks are used to measure time.  If you use a slower tick frequency then you cannot measure time with the same accuracy.  If that matters or not depends on your application.

I recommend that you check your system configuration by measuring to tick frequency to ensure it is as you expect it to be.  This can be done by defining a tick hook function that toggles and output, and then measuring the toggle frequency on the output.

Regards.

michaelchiu wrote on Wednesday, February 01, 2012:

Thanks for your reply.

2) Yes, I had also modifyied  this two value in rskrx210def.h.