We are using a port with 64MHz CPU clock which is stable.
The configTICKRATEHZ is set 1000
Richard asked you a lot more. The information he’s asking for is necessary to make a correct diagnosis.
These were his questions:
- Which port are you using?
Richard is asking what platform and CPU you are using ( and please be exact about this ).
- Does the chip have a stable and accurate clock?
- Or is it using a lower accuracy internal resonator?
The phrase “64MHz CPU clock which is stable” is not really convincing. Maybe the CPU gets 64 MHz, but oscillators are usually slower, like e.g. 8 or 12 MHz.
Can you tell what component is generating the clock? What are it properties?
Or does it run on an internal resonator?
- Have you checked the accuracy of the clock and the tick frequency using a scope?
I know that X-tals come in different qualities, just like resistors. Cheap resistors have a resistance of e.g. 22 K +/- 5%. The actual frequency of X-tals also varies from part to part.
- Are you setting the tick frequency to something that can be achieved exactly?
- Or are you using a slow low power clock and attempting a tick frequency that can’t actually be achieved exactly (considering rounding errors, etc.).
On some platforms and for some clocks, a frequency of exactly 1000 Hz can not be produced, at the best an approximation. You will have to check the reference of your CPU and look-up the timer that produces the FreeRTOS clock-tick. It has an input frequency ( which can be changed in some cases ), and it has a divisor. You will find a formula like:
F-output = F-input / divisor
If the deviation can be explained and if is quite constant ( 5:45 in stead of 5:00 ), you may want to “calibrate” the clock and use a different frequency in your calculations ( E.g. 869 Hz ).