# FreeRTOS clock running too fast?

**URL:** <https://forums.freertos.org/t/freertos-clock-running-too-fast/17582>\
**Category:** Kernel\
**Created:** [June 6, 2023, 2:59am UTC](https://forums.freertos.org/t/freertos-clock-running-too-fast/17582 "2023-06-06T02:59:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![migmel](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@migmel](https://forums.freertos.org/u/migmel)\
**Post date:** [June 6, 2023, 2:59am UTC](https://forums.freertos.org/t/freertos-clock-running-too-fast/17582/1 "2023-06-06T02:59:26Z")

</div>

Hello guys,  
I am working with a (ARTERY) Cortex M4 MCU with a clock set at 288 MHz.  
The problem I am having is the FreeRTOS clock is kind of running too fast.  
Example: vTaskDelay( 1000 / portTICK\_RATE\_MS ) delay last milliseconds and not 1 second as it’s supposed to be.  
I guess there is something should be set that I am missing; but I’m a newbie and cannot figure it out.  
Any help would be greatly appreciated.  
Thank you

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [June 6, 2023, 4:40am UTC](https://forums.freertos.org/t/freertos-clock-running-too-fast/17582/2 "2023-06-06T04:40:05Z")

</div>

Are you using SysTick or some other timer to drive FreeRTOS tick? Have you defined `configCPU_CLOCK_HZ` and `configTICK_RATE_HZ` correctly in your FreeRTOSConfig.h?

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [June 6, 2023, 5:00am UTC](https://forums.freertos.org/t/freertos-clock-running-too-fast/17582/3 "2023-06-06T05:00:29Z")

</div>

When I google “artery cortex m4”, I find an MCU that runs at 96 MHz. Aren’t you overclocking the part?

---

<div class="post-metadata">

**Author:** ![migmel](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@migmel](https://forums.freertos.org/u/migmel)\
**Post date:** [June 6, 2023, 5:13am UTC](https://forums.freertos.org/t/freertos-clock-running-too-fast/17582/4 "2023-06-06T05:13:10Z")

</div>

No way, it is the AT32F435ZMT7

---

<div class="post-metadata">

**Author:** ![migmel](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@migmel](https://forums.freertos.org/u/migmel)\
**Post date:** [June 6, 2023, 5:21am UTC](https://forums.freertos.org/t/freertos-clock-running-too-fast/17582/5 "2023-06-06T05:21:07Z")

</div>

I had this setting in the FreeRTOSConfig.h header:

#if defined( **ICCARM** ) || defined(\_\_CC\_ARM) || defined( **GNUC** )  
#include \<stdint.h\>  
extern uint32\_t SystemCoreClock;  
#endif  
.  
.  
.  
**#define configCPU\_CLOCK\_HZ ( SystemCoreClock )**  
**#define configTICK\_RATE\_HZ ( ( TickType\_t ) 1000 )**

Now I have, for testing purposes, replaced (SystemCoreClock) with the value of the clock: 288000000 and it started working as expected.

I guess SystemCoreClock was not providing the real clock value.

Thank you

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [June 6, 2023, 5:24am UTC](https://forums.freertos.org/t/freertos-clock-running-too-fast/17582/6 "2023-06-06T05:24:51Z")

</div>

> [@migmel](#):
>
> I guess SystemCoreClock was not providing the real clock value.

This variable is usually updated by the startup code. You can search for the function where it is updated and try to see why it is not called.

---

<div class="post-metadata">

**Author:** ![migmel](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@migmel](https://forums.freertos.org/u/migmel)\
**Post date:** [June 6, 2023, 5:26am UTC](https://forums.freertos.org/t/freertos-clock-running-too-fast/17582/7 "2023-06-06T05:26:48Z")

</div>

I’ll do, thank you very much
