Skip to main content
May 3, 2017
Solved

STM32L1 and STM32L4 Series LSE 32,768Khz Startup Problem

  • May 3, 2017
  • 5 replies
  • 3309 views
Posted on May 03, 2017 at 23:26

Hi all,

I have 3 boards with 3 different MCUs, one with STM32L053R8T6, one with STM32L152RCT6, and one with STM32L443RCT6.

All use same 32,768Khz LSE crystal and 12pF caps. But only STM32L053 works fine when LSE is turned on ...

other two MCUs jump to Error handler function. i used STM32Cube for all 3 MCUs. a simple program to turn on LED for example ...

I even changed the crystal with another type, or increased LSE Timeout Value in STM32Cube to 10000 but still no result.

I checked in Debug, the LSERDY flag is not activated and it leads to Timeout and jump to Error Handler function.

What can be the problem ?!

#lse-startup
    This topic has been closed for replies.
    Best answer by
    Posted on May 15, 2017 at 07:42

    The problem is found !

    Thank you all for your helps, all problems were because of CSS (Clock security system) enabled in my MCU !

    It stops OSC if a small failure occurs and won't start again until power restart (not even hardware reset). when running normally, if i touch crystal pins, CSS disables 32Khz OSC but CPU continues to run code. I've written a small code to turn on LCD clocked from 32Khz LSE, so when it stops, LCD also stops and i couldn't see if he cpu is working or not !

    I used Keil debugger to monitor where the code is, if i've touched OSC before entering debugger, when debugger starts, it first resets the MCU but CSS bit is not cleared this way, so in new code running in debugger mode, i just saw that LSE doesn't start and CPU jumped to Error Handler().

    in other hard environment (like -10c Temp) CSS just stops LSE after startup and the flag remains even if reset MCU. it prevents LSE start again.

    5 replies

    Tesla DeLorean
    Guru
    May 3, 2017
    Posted on May 04, 2017 at 00:24

    >>What can be the problem ?!

    Component choices, layout?

    What is the part number/specification of the 32.768KHz crystal? Did you follow the app note selecting the crystal and capacitors?

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    May 4, 2017
    Posted on May 04, 2017 at 11:58

    Here is the Layout:

    0690X00000606vbQAA.png

    The bottom polygon is connected to GND too.

    C13 and C14 are crystal Caps, first i used 12pF caps, no result.

    I changed it to 10pF and now it works !

    Crystal is:

    Epson  MC-406 32.768K-A3

    Crystals 32.768KHz 12.5pF -40C +85C

    I worry for later working ... after i checked forum, i saw many others have same problem, the oscillator is too sensitive, i can't trust on it for long time working !

    Is there anyway to get sure the OSC works fine later too ?!!

    waclawek.jan
    Super User
    May 4, 2017
    Posted on May 04, 2017 at 12:04

    See AN2867.

    JW

    Nesrine M_O
    Associate
    May 4, 2017
    Posted on May 04, 2017 at 12:21

    Hi

    fallah.omid

    ,

    As it is said by Jan try to refer to

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

    Application notethat show how to determine the different external components and provide guidelines for a good PCB for the oscillator.

    -Nesrine-

    May 4, 2017
    Posted on May 04, 2017 at 12:43

    I saw AN2867 after this problem.

    at first paragraph:

    'In practice, most designers do not even really pay attention to the oscillator design until they realize the oscillator does not operate properly (usually when it is already being produced).'

    I didn't pay attention too but a reason was because i didn't have this problem before. when working with AVR and AVR Xmega series MCUs.

    May 6, 2017
    Posted on May 06, 2017 at 16:50

    Can I use LCR meter to find the PCB capacitance ? or total capacitance when crystal is connected to MCU (after soldering...) ?

    Best answer
    May 15, 2017
    Posted on May 15, 2017 at 07:42

    The problem is found !

    Thank you all for your helps, all problems were because of CSS (Clock security system) enabled in my MCU !

    It stops OSC if a small failure occurs and won't start again until power restart (not even hardware reset). when running normally, if i touch crystal pins, CSS disables 32Khz OSC but CPU continues to run code. I've written a small code to turn on LCD clocked from 32Khz LSE, so when it stops, LCD also stops and i couldn't see if he cpu is working or not !

    I used Keil debugger to monitor where the code is, if i've touched OSC before entering debugger, when debugger starts, it first resets the MCU but CSS bit is not cleared this way, so in new code running in debugger mode, i just saw that LSE doesn't start and CPU jumped to Error Handler().

    in other hard environment (like -10c Temp) CSS just stops LSE after startup and the flag remains even if reset MCU. it prevents LSE start again.