Skip to main content
gocchan
Senior
Jun 25, 2026 6:36 AM UTC
Solved

How to develop software for a custom board without a 32kHz Xtal.

Hello,
I'm prototyping a custom board equipped with a WBA23KE and developing its software.
Since this custom board doesn't have a 32kHz crystal, I modified the code based on BLE_p2pServer, referencing the description on the following website.
LSEクリスタルなしでSTM32WBA上でRFアプリケーションを動かす方法 - stm32mcu
However, the HAL_RTC_Init() function on line 615 of the attached main.c fails and goes into ErrorHandler().
How should I modify the code?

gocchan
gocchanBest answer
Senior
Jul 23, 2026 4:40 AM UTC

I discovered that it works even without directly editing the code in CubeIDE; you just need to configure it correctly in CubeMX and generate the code.

I think all you need to do is avoid selecting LSE in the Clock Configuration in MX.

 

6 replies

Pavel A.
Jun 25, 2026 12:16 PM UTC

In line 323 HAL_PWR_EnableBkUpAccess() is commented out. Uncomment  it.

 

gocchan
gocchanAuthor
Senior
Jun 29, 2026 4:54 AM UTC

I commented it out, but the situation didn't change.

gocchan
gocchanAuthorBest answer
Senior
Jul 23, 2026 4:40 AM UTC

I discovered that it works even without directly editing the code in CubeIDE; you just need to configure it correctly in CubeMX and generate the code.

I think all you need to do is avoid selecting LSE in the Clock Configuration in MX.

 

ClaudioVertemara
ST Employee
Aug 7, 2026 12:20 AM UTC

Hi ​@gocchan,

I believe you already figured it out, but please find below a helpful Wiki article in case you still need it.

https://wiki.st.com/stm32mcu/wiki/Connectivity:STM32WBA_without_LSE_crystal

Kind regards,
Claudio

Explorer II
Aug 7, 2026 12:29 AM UTC

The hyperlink in his post is the Japanese version of the Wiki page.
Maybe some configuration wrong with the clock tree.

Laurent LOUAZON
ST Employee
Aug 20, 2026 8:47 AM UTC

Hello,

Please note that LSI2 option is not available for stm32wba2;
Wiki https://wiki.st.com/stm32mcu/wiki/Connectivity:STM32WBA_without_LSE_crystal is only valid for STM32WBA5 and STM32WBA6.
If willing to use STM32WBA2 without LSE Xtal, you should use HSE/1000 for low speed clock but you will not get low power mode.

 

Regards
Laurent