How to "create" an RTC (yy-mm-dd/hh:mm:ss standard) based on the internal LPC15xx´s RTC timer?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to "create" an RTC (yy-mm-dd/hh:mm:ss standard) based on the internal LPC15xx´s RTC timer?

2,222 Views
xavieralbornoz
Contributor III

My system will be off many times during a day but when turned-on, it must show the proper date (yy-mm-dd/hh:mm:ss) on its LCD.

Labels (3)
10 Replies

1,491 Views
zaidshaikh
Contributor II

Hello,

Hope your able to use the rtx of lpc15xx and get the desired result

0 Kudos

1,491 Views
xavieralbornoz
Contributor III

In fact I´m already using the LPC15xx family, at least in 12 different projects. But due to this RTC bug, once the device is on, I "control" the DATE/TIME information based on the sys-tick timer. And at each 5 minutes (considering the device was not powered-off) I´m reprograming the RTC->COUNT register with minus 1 second, but keep showing the DATE/TIME info according my sys-tick timer cadence. I know this is stupid ... not the more accurate way to solve the problem ... but according my measures, at each 5 minutes the RTC timer increases 1 second at the counting. Well, any way, LPC15xx is a great solution to my products and RTC accuracy is not tremendously mandatory and with this dumb work-around I´m solving this inconvenient problem.

0 Kudos

1,491 Views
zaidshaikh
Contributor II

Hello,

If ur using keil ide then you can directly #include"time.h" in your project. Also refer to https://www.epochconverter.com/programming/c for the time. 

1,491 Views
xavieralbornoz
Contributor III

Hi Zaid. Once more I thank you for your tip.

0 Kudos

1,492 Views
zaidshaikh
Contributor II

Hello Xavier, 

There is this thing "epoch time". You can refer to the website.https://www.epochconverter.com 

The lpc15xx rtc increments counts every second so use the value to calculate the time.

Also there is a "C" library "time.h" its has functions strftime(), mktime(), ctime. You can use these function to calculate the time. 

1,492 Views
xavieralbornoz
Contributor III

Dear Zaid, I thank you so much for your tip. Very very very interesting. In fact, my solution is based in some tables with the amount of counting seconds since 2000 til 2099. And 2 tables with seconds to a regular and leap year. But your suggestion looks more professional and embracing as mine ... Thanx a lot !!! I was trying to know how to use the libraries you´ve mentioned but I didn´t find any reference of how to do it, how to get them or how to order them ... Any additional tip?

Regards,

Xavier

0 Kudos

1,492 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Xavier,

In the user manual of the LPC15xx (UM10736) Chapter 18: LPC15xx Real-Time Clock (RTC) you will find that the RTC doesn't have a register for clock and date. So if you want to "create" the following structure yy-mm-dd/hh:mm:ss you can use the RTC as base clock, since it's really precise but you will have to make your own implementation for the clock and the date. If you want to see how to configure the RTC you can use the examples of the LPCOpen as a guide. 

Hope it helps! 

Have a great day, 

Victor.

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,492 Views
xavieralbornoz
Contributor III

Hi Jimenez! I thank you for your reply. In fact I´m already doing it, inside my code, by means some tables based on seconds values. I thought there was something very well ellaborated ... problably my way of doing that is not the best one. But anyway, I thank you so much for your tips.

Have a nice day !!!

Xavier

1,492 Views
Dezheng_Tang
NXP Employee
NXP Employee

Unfortunately, there is an errata about RTC on LPC15xx, and currently, there is no work-around on this:

https://www.nxp.com/docs/en/errata/ES_LPC15XX.pdf

0 Kudos

1,492 Views
xavieralbornoz
Contributor III

Hi Tang. That´s true ... Thanks for remaind me ... I will try to work-around this bug by my self.

Regards,

Xavier

0 Kudos