portTICK_RATE_MS Resolution

Posted by rog57 on December 28, 2012
Hi,
In the "FreeRTOSConfig.h" file, this is declared:
#define configTICK_RATE_HZ( ( portTickType ) 1000 )

In my program, I have this declared:
#define mainLED_TOGGLE_RATE( ( portTickType ) 5000 / portTICK_RATE_MS )

When I use this:
vTaskDelayUntil( &xLastFlashTime, mainLED_TOGGLE_RATE );

I would expect it to flash every 5 seconds; however, it's flashing at about 7 or 8 seconds. After reading the application manual, I think I understand this topic, but clearly I do not. Can anyone point out the error of my ways?

Regards,
Gary





RE: portTICK_RATE_MS Resolution

Posted by Richard on December 28, 2012
I suspect there will be a mismatch between the configCPU_CLOCK_HZ setting and the actual clock frequency being used.

Regards.

RE: portTICK_RATE_MS Resolution

Posted by rog57 on December 28, 2012

That was exactly the problem; I displayed all the clock and peripheral registers and updated the value of configCPU_CLOCK_HZ to reflect that value. It's now working fine.

Thanks for the "timely" help!

Gary




RE: portTICK_RATE_MS Resolution

Posted by rog57 on December 28, 2012
I also want to say the support I've received on this forum is far better than anything I've paid for from any vendor. Great tool, and the assistance is very appreciated!