cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L071CBT6 + LSE : ABS07-120-32.768kHz : Doesn't start

stephane239955
Associate II
Posted on May 31, 2017 at 16:07

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 0690X00000603rMQAQ.jpg

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 #stm32l0
4 REPLIES 4
kormoczi
Associate II
Posted on September 25, 2017 at 23:24

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?

Posted on September 26, 2017 at 00:02

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.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
cleric4
Associate II
Posted on September 26, 2017 at 06:25

Use 1M resistor parallel crystal, sometimes it helps.

kormoczi
Associate II
Posted on September 27, 2017 at 23:03

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.