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 2014 Threads]
I'm using FreeRTOS since 7.4.0 and since then I have to add to every update the initialization of the systick register on "port.c" file from the "/Source/portable/GCC/ARMCM0/" folder.
The problem is that the code initialize the portNVICSYSTICKLOAD with the calculated clock value, but after that line not initializes the portNVICSYSTICK_VAL to 0. It causes a start-up random delay of the first tick, because the we have to wait the transition from 1->0 from a counter that have a random number.
Remember that the value of this register after a reset is: Unknown.
On a speedy hardware's this is not important but in battery designs with low frequency clocks this matter.
The patch is very simple, on "/Source/portable/GCC/ARM_CM0/port.c" add:
Add the definition of the register:
>#define portNVICSYSTICKCTRL ( ( volatile uint32t *) 0xe000e010 )
>#define portNVICSYSTICKLOAD ( ( volatile uint32t *) 0xe000e014 )
>#define portNVICSYSTICKVAL ( ( volatile uint32t *) 0xe000e018 ) // <-- new line
>#define portNVICINTCTRL ( ( volatile uint32t *) 0xe000ed04 )
>#define portNVICSYSPRI2 ( ( volatile uint32t *) 0xe000ed20 )
Add the initialization of the register to zero:
>/* Configure SysTick to interrupt at the requested rate. */
>*(portNVICSYSTICKLOAD) = ( configCPUCLOCKHZ / configTICKRATEHZ ) - 1UL;
>*(portNVICSYSTICKVAL) = 0; // <-- new line
>*(portNVICSYSTICKCTRL) = portNVICSYSTICKCLK | portNVICSYSTICKINT | portNVICSYSTICKENABLE;
Thanks for the info, we will investigate this asap.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.