2017-02-23 02:32 AM
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 startoscillating. 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
.The 12pF capacitor can be found
.The 6pF capacitor can be found
.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 #stm32f02017-02-23 04:04 AM
Post you PCB layout at aronud the crystal (or a photo).
JW
2017-02-23 04:44 AM
Hi
blanc.quentin
,Please refer tothese application note to verifyyour hardware implementation.
-Nesrine-
2017-02-23 05:09 AM
STM32 LSE oscillators are made to work with very low consumption, and are therefore very sensitive...
You should have a look at
.Try to play with the drive level of the oscillator.
/**Configure LSE Drive Capability */
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_HIGH);
regards.
Max
2017-02-23 05:41 AM
Here is the PCB layout as asked. If you need more just ask.
Blanc Quentin
2017-02-23 06:28 AM
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
2017-02-23 06:53 AM
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?
2017-02-23 07:01 AM
teissier.maxime
, Thank you for your advice.I'm sure that the crystal is soldered in the right direction.
2017-03-01 11:29 PM
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.
2017-03-07 01:20 PM
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?