Slow 32 kHz Oscillator Startup

In an IoT (Internet of Things, see “IoT: FreeRTOS Down to the Micro Amps“) project I’m using the Freescale KL15Z microcontroller. The nodes are moving around, and the board is using a special inductive charging ‘on the fly’ when nearby the charging station. The energy is stored in capacitors, so no batteries are needed. That worked very well, but some system failed: they need to quickly check sensor signals after power-up. Tracking down the problem, it was obvious that most of the systems failed because it took them too long to boot from the power-on reset. So I instrumented the application to toggle an LED so I can monitor what happens: It was over 400 ms after power-on! Yikes!

413 ms for startup

413 ms for startup

That did not make any sense to me, so I was suspecting something must slow down the startup somehow, as I have not seen this in the previous design, and it works well with a normal reset. It only failed with POR (Power-On Reset). Debugging is not easy, as I cannot have a debugger attached in my test scenario. Well, until I realized the problem (stupid me!): the startup time of the clock oscillator!

I have a 32 kHz low power oscillator on my board, and these oscillators are known (not to me until now 😦 ) for slow startup time. See this article which explains some of the aspects.

Changing the system to start from the internal reference clock instead of the external one showed a huge improvement: startup time in less than 3 ms, that’s what I would have expected 🙂 :

Startup with internal reference clock

Startup with internal reference clock


There is always something to learn ;-). So the solution for me is to start the microcontroller with the internal reference clock so I can make a fast signal checking. Then I can switch to the external clock later in the application flow, so doing clock switching: internal reference clock for fast startup, then switching to the external 32 kHz clock.

Happy Starting 🙂


3 thoughts on “Slow 32 kHz Oscillator Startup

  1. Hi Erich,

    I knew about the slow startup time with low power crystal oscillators, but it was so far down in my memories archive that I would have fallen into the same trap as you anyway :). Thanks for refreshing my memory.

    I enjoy reading your posts about everyday embedded challenges.

    Regards, Shaun.


  2. One of the things to remember about crystals is they store mechanical energy. One start up you are pumping energy into the crystal. Each cycle you add a little more energy to the crystal. A low frequency crystal is going to take a lot longer to start up then a high frequency one. Another issue is 32khz xtal’s have higher impedance and lower Q’s than their MHz cousins. Thus they also tend to be a lot more sensitive to noise and layout issues.

    One time the layout guy on a project of mine ran a trace out and under the 32khz xtal used not only for time keeping but as a reference for the PLL used for the system clock. Whatever seemed to work okay until I had some unexplained communication issues. Turned out noise the signal line next to the 32khz osc was causing it to ‘burp’ and then the PLL would swing wildly. And you’d get RS232 framing errors.

    Other potential annoyances they are really sensitive to leakage on the board. Some types of no clean solder designed for production rework use leaves a conductive film on the board. If used in a lab where you really cannot clean your boards well, problems. (I like ordinary rosin flux core solder for this reason) And normal condensation will cause them to stop working or work erratically. Classic, stick the unit in the freezer, stops working until the condensation freezes. And then of course will stop working again when you pull it out.


What do you think?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.