2018-04-13 02:13 AM
Hi,
I use the STM32CubeMX to send data using UART, but I have a clock frequency problem,
I configured the clk as shown on the picture below
logically, I should obtain 80MHZ as an outpout frequency, but when I use the scope, it is
fixed
all of the time at 16 MHZ if I use MSI or HSE as shown on the picture below
and it is fixed at 32 MHZ if I use the HSI,
I tried to use the different divisions /1, /8.. and the different clk (PPLCK, SYCLK, HSE...) to obtain the correct frequency, but everytime, I have the same frequency output that I showed on the scope,
The same problem, if I use the HAL_RCC_GetSysClockFreq() instruction, It gives 16 MHz and 32MHz values, we can't reach the 80MHz!!
below the code,
We need to understand this contradiction to advance, because we use the baudrate variable in our project, and the baudrate depends on the frequency value!
Thanks in advance,
Mohamed
2018-04-18 04:35 PM
Can't this be the result of the CubeMX bug as in
https://community.st.com/0D50X00009XkWRGSA3
?JW
2018-04-19 02:39 AM
Hello
mohamed.gorrab
,Which firmware package and CubeMX version are you using ?
Could you please confirm if you have the same problem mentioned by waclawek.jan.
Best Regards,
Imen
2018-04-19 05:05 AM
Hello, you are either:
- facing the problem pointed by Jan,
- or your HSE oscillator is not working as expected and the clock falls back to HSI (because the CSS is enabled as per your screen shot)
There are many reason that could cause the HSE to fail.
If you are in this case, tell us more about your hardware:
-what board are you using?
-How is the oscillator designed? ...
2018-04-20 07:18 AM
Hello Mohamed,
Looking at your clock tree I assume that you work with STM32L4 MCUs family.
It could be that you faced CubeMX issue with code generation for clock domain. Could you please take a look on this thread:
https://community.st.com/0D70X000006SldESAS
? The issue described there is wrong PLLM parameter set by CubeMX.Regards
Szymon
2018-04-20 08:14 AM
Hi
DAHMEN.IMEN
,It is CubeMX v4.0, I use IAR embedded for that,
Yes, it's the same problem as
waclawek.jan, As I understand, there is no solution !!!??
Best regards,
Mohamed GORRAB
2018-04-23 06:26 AM
Hi Mohamed,
This is due to the lack of the PLLM configuration, it is a known issue and will be fixed next release.
As workaround you can use the LL driver for RCC code generation.