5 years, 12 months ago.

RTC in KL25Z

Do you know if it is possible to use the RTC of the KL25Z board?

Can this lib help you?

Regards Clemente

posted by clemente di caprio 24 Sep 2013

Does kl25z have inbulid RTC? If yes how to use it?

posted by Shreya Makineni 16 Feb 2017
Comment on this question

3 Answers

5 years, 12 months ago.

On the time page it has a comment on the RTC setup used on the KL25Z, so I guess it should work.

What page? I don't understand why do you mean with "time page". Thanks.

posted by Mick Kelo 27 Apr 2013

The RTC (time) handbook page:

posted by Erik Olieman 27 Apr 2013
5 years, 12 months ago.

The RTC will work the same as the Mbed LPC1768, however there are some very important differences you need to know.

The 32kHz RTC clock input is derived from the SDA mcu, so when reflashing or reseting the KL25Z the RTC registers will loose some time, or stop counting durring that process, a matter of 10 seconds when reflashing and a couple of seconds on reset. This does not happen with the LPC1768.

The RTC clock does not have a back up voltage input (Vb on the LPC1768) to keep it running when the processor is not powered. So to keep the RTC going you will need to keep the power (3.3v) to the chip and a 32kHz input to the RTC Clk input. This process will take around 9mA (for the KL25Z chip on its own) so for long term RTC back up the KL25Z is a non starter at the moment.

If you look at this link you can see a little more info on this:

You can see where I have added a low power 32kHz oscillator chip from Farnell (£3 I think) and this works well all the time the processor is powered.

I belive it is possible to generate the 32kHz from the KL25Z's own internal clock source and feed it back into the RTC Clk input, I have asked this question a couple of times now, but I think no one has the answer. Even if this was possible I think the KL25Z would consume too much power to keep the clock generators running durring RTC back up.

If you want RTC functions for the KL25Z then I would suggest this:

Thanks Paul. So, you think that the best option to get a RTC running with the KL25Z is look for an external component, don't you?

posted by Mick Kelo 28 Apr 2013

Yes Mick If you want a low power RTC function I think its the only way unless the existing Mbed library is changed.

posted by Paul Staron 28 Apr 2013
5 years, 11 months ago.

Have a look at Freescales site they do a step by step, although its not mbed Yours Simon M..

Thanks Simon, I have seen something similar to this, however any ideas how to put this code into Mbed to configure the registers?

posted by Paul Staron 14 May 2013

Hi Paul, It shouldn't be a problem putting these registers in mBed online as if in case the mBed library has the declarations all filled in, the same as it happens in Arduino

posted by Nishant Sood 06 Jun 2013

The embed library does have the RTC registers defined. They are defined in RTC_Type in the MKL25Z4.h file. I need a low power RTC for my project so I will need to do this to achieve battery capability. I will also need to change clock and power modes. I am only a beginner so progress will be slow. The RTC and the slow internal reference clock (RC osc only, but factory trimmed and can be auto-trimmed if their is a xtal osc as an external reference). The RTC and internal ref. systems appears able to run in stop mode. See the Sub-Family Reference Manual for further details.

cheers pete

posted by Pete Eisenhuth 24 Sep 2013

To post an answer, please log in.