dksquires wrote on Thursday, June 11, 2009:
After upgrading an AVR32 UC3A project to use the latest FreeRTOS V5.3.0, I noticed that the delays generated by vTaskDelay were half as long as expected. Further investigation revealed that when the default configuration in FreeRTOSConfig.h has:
#define configTICK_USE_TC 1
#define configTICK_TC_CHANNEL 2 // Note: actually any channel would have the same issue
that the initialization of the timer counter in waveform mode has a mistake. Specifically, when the RC register is loaded on line 446 of port.c, the expression for the value to be loaded into rc assumes that the timer/counter TIMER_CLOCK2 has a frequency of PBA clock/4. The actual rate of TIMER_CLOCK2 is PBA clock/2 per section 12.4.1 of the latest UC3A datasheet.
So, I believe that line 446 of port.c should be:
tc_write_rc( tc, configTICK_TC_CHANNEL, ( configPBA_CLOCK_HZ / 2) / configTICK_RATE_HZ );
With this change made, the timer ticks occur at the expected rate.
David Squires,
Squires Engineering, Inc.
Melbourne, FL