cancel
Showing results for 
Search instead for 
Did you mean: 

LSE Crystal fail to start

Quentin Blanc
Associate II
Posted on February 23, 2017 at 11:32

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

http://eu.mouser.com/ProductDetail/Epson-Timing/MC-306-327680K-A0ROHS/?qs=sGAEpiMZZMsBj6bBr9Q9acukpafrIaZ1R56uLk59WWc%3d

.

The 12pF capacitor can be found

https://www.distrelec.ch/en/capacitor-12-pf-0805-rnd-components-rnd-1500805n120j500/p/30065870?q=258799&page=1&origPos=1&origPageSize=50&simi=98.0

.

The 6pF capacitor can be found

http://eu.mouser.com/ProductDetail/AVX/08055A6R0CAT2A/?qs=sGAEpiMZZMs0AnBnWHyRQEncggutzp42xImDo6lXcbY%3d

.

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

#stm32 #stm32f030 #rtc_waitforsynchro #lserdy #lse-rtc #lse #crystal #rtc #stm32f0
15 REPLIES 15
Jan Waclawek
Senior II
Posted on February 23, 2017 at 13:04

Post you PCB layout at aronud the crystal (or a photo).

JW

Max
ST Employee
Posted on February 23, 2017 at 14:09

STM32 LSE oscillators are made to work with very low consumption, and are therefore very sensitive...

You should have a look at

http://www.st.com/content/ccc/resource/technical/document/application_note/c6/eb/5e/11/e3/69/43/eb/CD00221665.pdf/files/CD00221665.pdf/jcr:content/translations/en.CD00221665.pdf

.

Try to play with the drive level of the oscillator.

/**Configure LSE Drive Capability */

__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_HIGH);

regards.

Max

Posted on February 23, 2017 at 13:41

Here is the PCB layout as asked. If you need more just ask.

Blanc Quentin

0690X00000606MDQAY.png0690X00000606PVQAY.png
Posted on February 23, 2017 at 14:28

Hi

teissier.maxime

,

I tried all four level of drive capability but none of then worked. I called the function 'RCC_LSEDriveConfig(RCC_LSEDrive_***)' just before I enable the LSE with the function 'RCC_LSEConfig(RCC_LSE_ON)'.

Thanks for helping.

Blanc Quentin

Posted on February 23, 2017 at 14:53

I don't like the 2 vias on OSC32_IN track and OSC32_OUT track seems too long to me.

You should start laying out your oscillator first to make sure the tracks are as short as possible.

But this is not bad enough to justify why your oscillator is not starting.

The EPSON MC-306 + 6pF capacitors is in the recommended listof

/external-link.jspa?url=http%3A%2F%2Fwww.st.com%2Fcontent%2Fccc%2Fresource%2Ftechnical%2Fdocument%2Fapplication_note%2Fc6%2Feb%2F5e%2F11%2Fe3%2F69%2F43%2Feb%2FCD002216pdf%2Ffiles%2FCD002216pdf%2Fjcr%3Acontent%2Ftranslations%2Fen.CD002216pdf

so it should be compatible

.

Are you sure you did solder the crystal is the right direction?

Posted on February 23, 2017 at 15:01

teissier.maxime

, Thank you for your advice.

I'm sure that the crystal is soldered in the right direction.

Gidi
ST Employee
Posted on March 02, 2017 at 08:29

Maybe its just a simple thing, did you check the pinout? maybe it was placed in reverse? 

Try also 3pF capacitors, see if it starts.

Meet Patel
Associate II
Posted on March 07, 2017 at 22:20

I am having exactly the same problem. I added the 32.768 kHz crystal along with 22pF capacitors on the discovery kit and it worked perfectly. But then I tried it on the PCB and it wouldn't work. It's just stuck waiting for LSE_RDY flag.

The crystal I am using is connected directly to the STM32F051 controller without any Via. I tried the solutions suggested earlier, like changing the LSE drive to High. Nothing worked for me.

I am using 22pF capacitors with the 32.768kHz oscillator both in DIP package. Could that be an issue? Is 22pF too high?