cancel
Showing results for 
Search instead for 
Did you mean: 

RTC not work

np1
Associate II
Posted on March 09, 2012 at 04:26

Hello all,

I connected crystal 32.768 khz to pin C5,C6 of stm8l151.

I want to use RTC-calendar but look like crystal not work.

  /* Enable LSE */

  CLK_LSEConfig(CLK_LSE_ON);

  /* Wait for LSE clock to be ready */

  while (CLK_GetFlagStatus(CLK_FLAG_LSERDY) == RESET);

  /* wait for 1 second for the LSE Stabilisation */

  LSE_StabTime();

  /* Select LSE (32.768 KHz) as RTC clock source */

  CLK_RTCClockConfig(CLK_RTCCLKSource_LSE, CLK_RTCCLKDiv_1);

  CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);

Please help me

Thanks all,
1 REPLY 1
Nickname13136_O
Associate II
Posted on March 13, 2012 at 13:21

Hello,

May be your crystal is not oscillating. Pls refer AN2867 at  

http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/APPLICATION_NOTE/CD00221665.pdf

You can also check whether the signals are coming on both the csystal legs at 180 degrees phase shift.

I hope this wil help.

Regards,