Hello,
I am having difficulties with timers and vTaskDelay() with the STM32F processor. It appears that delays are about 2X the programmed rate.
I created a very simple task that delays for 4 seconds and reports the actual number of elapsed ticks. The ticks are correct but the actually delay is around 8 seconds.
Sample code:
TickType_t start_tick;
TickType_t end_tick;
do {
start_tick = xTaskGetTickCount();
vTaskDelay(4000);
end_tick = xTaskGetTickCount();
trace_printf("msec2ticks:%u ticks\n", (uint16_t)(end_tick-start_tick));
}
while (pdTRUE);
Originally I thought this was a problem in 8.2.3, however I back ported to 8.2.0 and received the same results.
The only other change is the trace output configuration. Changed:
Created a BlinkyLED application from the Eclipse/GNUARM plugin. Removed all the LED related code and used the simple timer routines. These worked as expected.
Copied the STM “system” code from the BlinkyLED project to the FreeRTOS test program. Same problem with the tick rate being 1/2 rate.
Compared the RCC register configuration between the two programs. They were the SAME!
I created a very simple task that delays for 4 seconds and reports the actual number of elapsed ticks. The ticks are correct but the actually delay is around 8 seconds.
When reading this my thought was, if the delay is correct in the number of ticks, but the time is different, then this is simply a case of the CPU clock running at a different frequency to that which you think it is. Perhaps configCPU_CLOCK_HZ is wrong. However, then you write:
you mention semihosting. Are you using semihosting? If so, don’t, it will mess up your timing as it will stop the CPU while outputing to the host - and that might be the problem you are seeing.