Over a million developers have joined DZone.

Slow 32 kHz Oscillator Startup

· IoT Zone

Access the survey results 'State of Industrial Internet Application Development' to learn about latest challenges, trends and opportunities with Industrial IoT, brought to you in partnership with GE Digital.

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 :-)

The IoT Zone is brought to you in partnership with GE Digital.  Discover how IoT developers are using Predix to disrupt traditional industrial development models.


Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}