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] [January 2017 Threads] systick slow start on CortexM0+ port with STM32L051C8, bug?Posted by lobaro on January 13, 2017 Hi,
we use the STM32l051c8 CortexM0+ MCU with the gcc port ("...portable/GCC/ARM_CM0") on FreeRTOS V9.0.0.
The mcu is clocked by the MSI sysclock (~4.2MHz) and had a problem with the prvSetupTimerInterrupt function.
On this MCU the reset value of the systick count ( @ Adr 0xe000e018 ) is 0xFFFFFF. The M0 port does not init the current value register. Moreover the systick current value is above the initialized reload value. This leads to the problem that (at least with this MCU) the systick has to count down to zero for full 24bits. With our setup this brings a ~4seconds delay before the first systick irq is executed...
Our solution was add a reset of the current value register in prvSetupTimerInterrupt to zero:
~~~
define portNVICSYSTICKCURRENTVALUE ( ( volatile uint32t *) 0xe000e018 )
void prvSetupTimerInterrupt( void )
{
/* Configure SysTick to interrupt at the requested rate. */
*(portNVICSYSTICKCURRENTVALUE) = 0;
*(portNVICSYSTICKLOAD) = ( configCPUCLOCKHZ / configTICKRATEHZ ) - 1UL;
*(portNVICSYSTICKCTRL) = portNVICSYSTICKCLK | portNVICSYSTICKINT | portNVICSYSTICK_ENABLE;
}
~~~
systick slow start on CortexM0+ port with STM32L051C8, bug?Posted by rtel on January 13, 2017 Hi Tobias - thank you for taking the time to report this. I think this
issue has already been noted and fixed.
systick slow start on CortexM0+ port with STM32L051C8, bug?Posted by pkinzer on February 10, 2017 Hi,
This bug still exists in FreeRTOS v9.0.0, for the ARM CM0 port, using IAR. I happen to be using it on an STM32F091 part. The source clearly does not initialize the SYST_CVR register. This particular part has a power-up value of 0xFFFFFF, which results in a 350ms delay before the first tick occurs, at 48MHz. My solution was to use the CMSIS call, which properly initializes the SysTick peripheral, so the first tick occurs in 1mS, in my case:
~~~
static void prvSetupTimerInterrupt( void )
{
SysTickConfig(configCPUCLOCKHZ/configTICKRATE_HZ);
}
~~~
It now works as expected, in 1mS, the first SysTick interrupt occurs. This one took me a while to track down, but it was an interesting challenge. :) See section 4.4 of the official ARM Cortex-M0 Generic User Guide for details on the SYST_CVR register:
(http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/Babieigh.html)
-Paul
systick slow start on CortexM0+ port with STM32L051C8, bug?Posted by rtel on February 10, 2017 See line 252 (at the time of writing) in the following file:
https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c
...it has been fixed. If you think the fix is wrong please let us know.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|