2016-02-14 10:19 PM
Hi,
I am trying the RTC function on the STM32L152C-discovery board, i have enabled LSE in the CubeMX (i did same for the HSE, it is working good), but i never got the RTC crystal working, i have tried to use scope to watch its wave, but nothing in there. does anyone who have such issue for the RTC?Thanks. #no-hablo-hal #!stm32-!cubemx-!rtc2016-02-15 03:39 AM
does anyone who have such issue for the RTC?
I don't know, it worked on my L1-DISCO using the SPL.Sticking a probe directly in the circuit will change the characteristics. Does the status indicate is the LSE started or not? Can you feed the clock to an MCO pin or timer?2016-02-15 04:54 AM
Hi Clive1,
Thanks for your reply.I tested with my logic analyzer for the 8MHZ, i can watch it and measure it without any problem, does that RTC crystal is that sensitive? What is the status can indicate the RTC clock is working, can you point it to me :)i did not try to route the clock to MCO pin (is it PA08 pin?), will try itThank you.2016-02-15 07:34 AM
I'm not sure if the RTC clock routes to MCO (PA8) or TAMPER on your part, you'd need to review the Reference Manual.
The SPL initializes and waits for the LSE clock like thisvoid RTC_Configuration(void)
{
/* Allow access to the RTC */
PWR_RTCAccessCmd(ENABLE);
/* Reset Backup Domain */
RCC_RTCResetCmd(ENABLE);
RCC_RTCResetCmd(DISABLE);
/* LSE Enable */
RCC_LSEConfig(RCC_LSE_ON);
/* Wait till LSE is ready */
while (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
{}
RCC_RTCCLKCmd(ENABLE);
/* LCD Clock Source Selection -- Note: RTC clock is used to clock the LCD*/
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
}