AnsweredAssumed Answered

LSE Crystal fail to start

Question asked by Quentin Blanc on Feb 23, 2017
Latest reply on Jun 13, 2017 by Meet Patel

Hello everyone,

I work on a clock project and have a problem with the LSE crystal. I first made my program on a STM32F0Discovery and it worked properly. Then I made a PCB with a STM32F030R8T6 and tried to program it but the LSE didn't start oscillating. I looked on the forum to see if anyone had the same issues than me and I found some people that said that it's the capacitors that cause the problem. They say that you need a crystal whit two 6pF capacitors and not a crystal with two 12pF like I had. So I tried that and it didn’t work either. Can someone help me further?

The crystal I'm using can be found here.

The 12pF capacitor can be found here.

The 6pF capacitor can be found here.

For Init fonction is:

void init_RTC (void)
{
   RTC_InitTypeDef RTC_InitStructure;
   RTC_TimeTypeDef RTC_TimeStructure;

   // Enable the PWR clock
   RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR,ENABLE);

   // Allow access to RTC
   PWR_BackupAccessCmd(ENABLE);

   // Reset RTC Domain
   RCC_BackupResetCmd(ENABLE);
   RCC_BackupResetCmd(DISABLE);

   // Enable the LSE OSC
   RCC_LSEConfig(RCC_LSE_ON);

   // Wait until LSE is ready
   while (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
   {
      //The program is hold in this loop
   }
   // Select the RTC Clock Source
   RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);

   // Enable the RTC Clock
   RCC_RTCCLKCmd(ENABLE);

   RTC_DeInit();

   //Disable write protection
   RTC_WriteProtectionCmd(DISABLE);

   RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_12;
   RTC_InitStructure.RTC_AsynchPrediv = 0x7F;
   RTC_InitStructure.RTC_SynchPrediv = 0xFF;
   RTC_Init(&RTC_InitStructure);

   RTC_TimeStructure.RTC_H12 = RTC_H12_AM;
   RTC_TimeStructure.RTC_Hours = 0;
   RTC_TimeStructure.RTC_Minutes = 0;
   RTC_TimeStructure.RTC_Seconds = 0x00;
   if(RTC_SetTime(RTC_Format_BCD, &RTC_TimeStructure)== ERROR)
      while (1) {};
   // Wait for RTC APB registers synchronisation
   RTC_WaitForSynchro();

}

 

 

Thank you for helping and have a nice day

Blanc Quentin

Outcomes