cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure 96 Mhz clock for application in STM32WBA55CG

BKaiwalya
Associate II

Hi,

I am programming the nucleo_wba55cg using Zephyr v3.7.0.

My application is based on a BLE peripheral example, whereby I have also configured an LED on the nucleo_wba55cg board to toggles at the rate of 1s.

Also, I modified the rcc section the nucleo_wba55cg.dts file to adapt to the higher system clock (96 MHz, similar to that of the nucleo_wba52cg) shown below:

 

&pll1 {
div-m = <8>;
mul-n = <48>;
div-q = <2>;
div-r = <2>;
clocks = <&clk_hse>;
status = "okay";
};

&rcc {
clocks = <&pll1>;
clock-frequency = <DT_FREQ_M(96)>;
ahb-prescaler = <1>;
ahb5-prescaler = <4>;
apb1-prescaler = <1>;
apb2-prescaler = <1>;
apb7-prescaler = <1>;
};

 

 
 
Expectation: while the BLE application is active, LED blinks at a frequency of 16 MHz (6 times slower so it toggles every 6 seconds as opposed to the 1 sec as configured in the application).
 
Later, I modified the application via SCM (https://wiki.st.com/stm32mcu/wiki/Connectivity:STM32CubeWBA_System_Clock_Manager#SCM_USERS_TABLE) to a higher clock (32 MHz) and added this function to the main.c file of my application. This resulted that the LED now blinks faster, where it toggles every 3 seconds.

 

main.c

scm_setsystemclock(SCM_USER_APP, HSE_32MHZ);

 

 

Could you please let me know how to correct this behavior and achieve the correct blinking pattern of the LED (1 seconds). In case this involves PLL settings, how to do it?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

Hello @BKaiwalya 

Could you please update the function:

scm_setsystemclock(SCM_USER_APP, HSE_32MHZ);

to:

scm_setsystemclock(SCM_USER_APP, SYS_PLL);

After setting the PLL mode and parameters through (mendatory before calling the scm_setsystemclock) :

void scm_pll_setconfig(const scm_pll_config_t *p_pll_config);

With PLLM = 8, PLLN = 48 PLLR = 2 and PLLFractional = 0.

STTwo32_0-1731601134040.png

More details about those functions are available on the scm.c and scm.h files. 

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
SofLit
ST Employee

Hello,

A simulation done on CubeMx:

SofLit_0-1731593787661.png

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
STTwo-32
ST Employee

Hello @BKaiwalya 

Could you please update the function:

scm_setsystemclock(SCM_USER_APP, HSE_32MHZ);

to:

scm_setsystemclock(SCM_USER_APP, SYS_PLL);

After setting the PLL mode and parameters through (mendatory before calling the scm_setsystemclock) :

void scm_pll_setconfig(const scm_pll_config_t *p_pll_config);

With PLLM = 8, PLLN = 48 PLLR = 2 and PLLFractional = 0.

STTwo32_0-1731601134040.png

More details about those functions are available on the scm.c and scm.h files. 

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.