cancel
Showing results for 
Search instead for 
Did you mean: 

Setting MSI,HSI or HSE and configure clock speed of SYSCLK ,HCLK and other cloks.

MOB1
Associate II

Hello, I have a stm32wb55 nucleo board,

I want to know that whats is the logic behind that , In reference manual it says 

After a system reset, the MSI oscillator, at 4 MHz, is selected .

Lets say I want to use HSI or HSE for specific application and I want to set SYSCLK, HCLKs and other clocks .

How can I implement a code that configure HSI,HSE selection and SYSCLK etc.

I want to do that using LL(low layer libraries).

Thanks for your helps

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

In CubeMX, Project manager tab->advanced, select to use HAL or LL for RCC code.

View solution in original post

4 REPLIES 4
gbm
Lead III

Read the RefMan section on RCC module. See the description of control register and PLL configuration register.

Write the code:

  • turn on the required clock source
  • wait for it to stabilize
  • set the PLL config and turn it on
  • set the Flash wait states in FLASH->ACR
  • wait for PLL to stabilize
  • switch to PLL

Each item above translates to a single C statement. That's it. No HAL or LL needed. To determine the values for PLL config, you may use CubeMX clock configuration tab.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
MOB1
Associate II

When we configure project via using cube ide or MX configuration manager we can easily set clock speeds.I saw some funcitons in low layer LL libraries like LL_RCC_HSI_Enable (void ). I want to do that steps with low layer library is there some functions to set clock configs?.

Pavel A.
Evangelist III

In CubeMX, Project manager tab->advanced, select to use HAL or LL for RCC code.

MOB1
Associate II

Thanks