cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong tick period at 180MHz STM32F446RE

Gzini.6
Associate II

hi everyone

i have a strange problem when i try to set clock frequency at high speed.

i'm using CubeMX to configure the system and developing on AtollicTrueStudio.

i’ve noticed some weird facts setting the clock frequency more than 120MHz.

first, is that the tick period result about 0.98ms. (at 180MHz)

doing osDelay(1000) and measuring with an oscilloscope the period of a digital pin toggling, the period is actually about 980ms.

with osDelay(100)->98ms.

i’ve configured the clock at 180MHz using the HSE, but here another problem, if from PLL source MUX i select HSE, 1 tick become 3.2ms instead of 1ms.

Selecting HSI from PLL source MUX, tick period become 0.98ms.

setting 120MHz and HSI everything work fine.

could someone reproduce this effect?

what's going on?

1 ACCEPTED SOLUTION

Accepted Solutions

> i’ve configured the clock at 180MHz using the HSE, but here another problem, if from PLL source MUX i select HSE, 1 tick become 3.2ms instead of 1ms.

Do you use an 8MHz crystal for HSE, while setting 25MHz in CubeMX?

> doing osDelay(1000)

Look at the source code of osDelay. There are many ways how timing can go wrong, often related to timing granularity.

HSI itslef is imprecise, too. Output system clock (possibly divided) to MCO and measure there.

JW

View solution in original post

2 REPLIES 2

> i’ve configured the clock at 180MHz using the HSE, but here another problem, if from PLL source MUX i select HSE, 1 tick become 3.2ms instead of 1ms.

Do you use an 8MHz crystal for HSE, while setting 25MHz in CubeMX?

> doing osDelay(1000)

Look at the source code of osDelay. There are many ways how timing can go wrong, often related to timing granularity.

HSI itslef is imprecise, too. Output system clock (possibly divided) to MCO and measure there.

JW

Gzini.6
Associate II

>Do you use an 8MHz crystal for HSE, while setting 25MHz in CubeMX?

yes this was the stupid mistake!

i've solved setting 8MHz as HSE clock freqeuncy

with HSI at 180MHz i still get that 2% of deviation but i think is due to his inaccuracy