FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [February 2016 Threads] STM32F10x tick rate 1/2 speedPosted by ajcurtis84 on February 2, 2016 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:
~~~~
TickTypet starttick;
TickTypet endtick;
do {
starttick = xTaskGetTickCount();
vTaskDelay(4000);
endtick = xTaskGetTickCount();
traceprintf("msec2ticks:%u ticksn", (uint16t)(endtick-starttick));
}
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:
~~~~
undef OSUSETRACE_SEMIHOSTING
define OSUSETRACE_ITM
~~~~
Has anyone else had this issue?
TIA
STM32F10x tick rate 1/2 speedPosted by ajcurtis84 on February 2, 2016 Here is some more information:
- 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!
RCC:CR = 0x00015283
RCC:CSR = 0x1C000000
RCC:AHBENR = 0x00000014
Can anyone provide further insight or recommendations?
Thanks
STM32F10x tick rate 1/2 speedPosted by heinbali01 on February 2, 2016 Hi Allen,
What is your program printing:
msec2ticks:4000 ticks
or
msec2ticks:8000 ticks
?
I suppose that configTICK_RATE_HZ is defined as 1000 ?
Wat does sysclk_get_cpu_hz() return? Is the CPU really running at the expected frequency?
Regards.
STM32F10x tick rate 1/2 speedPosted by rtel on February 2, 2016 When I read:
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 configCPUCLOCKHZ is wrong. However, then you write:
#undef OS_USE_TRACE_SEMIHOSTING
#define OS_USE_TRACE_ITM
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.
Regards.
STM32F10x tick rate 1/2 speedPosted by ajcurtis84 on February 2, 2016 Hello,
Thank you for the reply. No, I am not using SEMIHOSTING. Originally I was but it was causing all sorts of problems.
My BSP does not have the sysclkgetclk_hz() function so I inserted the following code.
~~~~
trace_printf("System clock: %u Hzn", SystemCoreClock);
RCC_ClocksTypeDef clock;
RCC_GetClocksFreq(&clock);
trace_printf("SYSCLK=%ld,HCLK=%ld,PCLK1=%ld,PCLK2=%ld,ADCCLK=%ld\n",
clock.SYSCLK_Frequency,
clock.HCLK_Frequency,
clock.PCLK1_Frequency,
clock.PCLK2_Frequency,
clock.ADCCLK_Frequency);
~~~~
This is the output
> System clock: 8000000 Hz
> SYSCLK=8000000,HCLK=8000000,PCLK1=8000000,PCLK2=8000000,ADCCLK=4000000
Based on this I debugged the SystemInit() function and determined that HSE never becomes ready. It looks like the oscillator isn't working?
Thank you for pointing me in the right direction.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|