Skip to main content
KMill.3
Associate
October 31, 2021
Question

Troubles enabling the 32.786kHz RTC clock.

  • October 31, 2021
  • 2 replies
  • 2052 views

Hi all,

I am working with a Nucleo STM32L452RE board and I had a bit of trouble enabling the RTC clock. I am just trying to get a scope shot of the waveform output by the clock itself and I noticed it was not on by default. I attempted to use a few example programs supplied by the IAR Embedded Workbench - specifically the RTC Alarm program. I keep getting stuck inside of an initialization error on line 206 of main.c and the RTC clock never starts up. Any thoughts on this? I've included the c files for the program below in case anyone is not familiar or cannot find it.

Thanks in advance for all your help!

This topic has been closed for replies.

2 replies

TDK
Super User
November 1, 2021

> RCC_OscInitStruct.HSEState = RCC_HSE_ON;

The Nucleo board gets its clock source from the onboard ST-Link by default. It doesn't use a crystal, so the HSE should be set to bypass mode:

RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;

This has nothing to do with the RTC, but it is the reason your program is stuck on line 206.

"If you feel a post has answered your question, please click ""Accept as Solution""."
KMill.3
KMill.3Author
Associate
November 1, 2021

Thanks so much! I changed that line and I still error.

I changed the example I was using to the RTC_LSI example but I still hang on the same line. Is that all I should need to change to use a nucleo board with this example? My problem lies entirely in the SystemClock_Config() function.

KMill.3
KMill.3Author
Associate
November 1, 2021

.