Quality RTOS & Embedded Software

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


STM32F103 with GCC systick err

Posted by label.sr on August 22, 2013
I use FreeRTOS V7.5.2 on STM32F103RE with GCC compile. But systick seem to be wrong. When I use:
vTaskDelay(1000 / portTICK_RATE_MS), the delay time seem to be 10 second, not 1 second. xQueueReceive(g_VolCtrlQ, &stQItem,400 / portTICK_RATE_MS) also delay about 4 second, not 400ms. But I run IAR Demo project is OK. Does any body meet this problem? Can anybody give me some advice? Thanks a lot.

RE: STM32F103 with GCC systick err

Posted by Richard on August 22, 2013
Are you using the same FreeRTOSConfig.h between the IAR and GCC projects?

If so, how is configCPU_CLOCK_HZ being set? If it is just mapped to SystemCoreClock then your GCC and IAR projects are probably setting SystemCoreClock differently, or the GCC project is not setting it at all.

If no, then is configCPU_CLOCK_HZ set to the same value in both files?

Are your IAR and GCC projects executing the same start up code?

It is likely the IAR project will be running start up code that configures the MCU clocks, and may even call a configuration file provided by the application before it calls main(). If you GCC project is not doing this then the frequency the chips are running at when main() is called could be different.


STM32F103 with GCC systick err

Posted by mrichmond68 on December 11, 2014

I'm also working with the STM32F103 and the GCC/ARMCM3 port. Just wanted to add that as a newbie (which I am) it was not automatically clear how configCPUCLOCK_HZ should be set and how much configuring I should do manually of sysTick before the freeRTOS got hold of it.

So here is what I found for V8.1.2, the GCC ARMCM3 port. configCPUCLOCKHZ should be set to the core clock rate, not to the core clock/8, and I don't need to do anything to SysTick. freeRTOS configures the SysTick clock source to be the core clock. This happens in FreeRTOSSourceportableGCCARMCM3port.c,vPortSetupTimerInterrupt().

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

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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

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

Xilinx Microblaze and Zynq partner