2017-05-31 07:07 AM
Hi,
I've a design based on STM32L071CBT6, and I'm using an Abracon Crystal : ABS 07-120-32.768kHz as recommanded in AN2867.
Here's an overview on my PCB, two capacitor (C4 and C5) 2.2nF/COG/50V/5% with the oscillator X1
From a SW point of view, I discover that troubles appear during execution of the function SystemClock_Config(void) :
TimeOut happen during execution of function HAL_RCC_OscConfig(&RCC_OscInitStruct), in LSE Configuration :
/* Set the new LSE configuration -----------------------------------------*/
__HAL_RCC_LSE_CONFIG(RCC_OscInitStruct->LSEState);/* Check the LSE State */
if((RCC_OscInitStruct->LSEState) != RCC_LSE_OFF) { /* Get timeout */ tickstart = HAL_GetTick(); /* Wait till LSE is ready */ while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) { if((HAL_GetTick() - tickstart ) > RCC_LSE_TIMEOUT_VALUE) { return HAL_TIMEOUT; } } }
I've tried to modify capacitors, 4.7pF, 10pF, or remove completly : no effet
I've add a line of code :
RCC_LSEDriveConfig(RCC_LSEDrive_
LOW); // Addes as mentionned in AN2867
HAL_RCC_OscConfig(&RCC_OscInitStruct);
But it doesn't work, same problem
With these small capacitance, unable to measure with scope, ... do you have idea or feedback using this crytal, or regarding this configuration
Thanks for your help
Best regards
#lse-osc32-not-starting-oscillation #lse-rtc #lse #stm32l02017-09-25 02:24 PM
Hi,
I have the exact same problem with an ABS07-120-32.768kHz-T crystal with
4.7pF caps
and an STM32L433 MCU./* Wait till LSE is ready */
while(READ_BIT(RCC->BDCR, RCC_BDCR_LSERDY) == RESET) { if((HAL_GetTick() - tickstart) > RCC_LSE_TIMEOUT_VALUE) { return HAL_TIMEOUT; } }I always get a time out, I routed out the LSE to MCO and nothing. I have tried different drive settings, the results are same. The crystal doesn't start. The
RCC_LSE_TIMEOUT_VALUE is 10sec.
Tried replacing the crystal, doubling the cap values without any success. Clock Security System is disabled in CubeMX
Any idea?
2017-09-25 05:02 PM
Doubling? You'd be better at closer to ~3.0pf (say 2.7pF or 3.3pF)
Make sure you've enabled/unlocked the PWR/BKP, and LSE_ON is high. Watch via peripheral view in debugger.
2017-09-25 09:25 PM
Use 1M resistor parallel crystal, sometimes it helps.
2017-09-27 02:03 PM
Thank you for your suggestions. The parallel resistor doesn't help, and the content of the registers are all correct except one: the LSEDRV is not set because the code generated by CubeMX has a bug. In SystemClock_Config function It calls the
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_HIGH) before HAL_RCC_OscConfig, and at that point there is no write access in Backup domain.
I have solved this bug by moving it
to right after the 'Backup domain Write protection disable' code section in the
HAL_RCC_OscConfig function
.Sadly I still have struggles with the LSE. The startup of the crystal is very random. Sometimes it starts within a sec, sometimes it starts only when I touch the crystal pin with the oscilloscope probe, and sometimes it won't start at all. I can't understand the logic behind this behavior. I guess I have to redesign/optimize the LSE section of my PCB, and then maybe there is a hope. Maybe, because as I see, a lot of people has unreliable results with it.