Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

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.

Attachments


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

Attachments


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.

Attachments


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS