2021-03-29 02:32 AM
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?
Solved! Go to Solution.
2021-03-29 11:07 AM
> 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
2021-03-29 11:07 AM
> 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
2021-03-29 11:23 PM
>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