keeping track of time (real world time)

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

keeping track of time (real world time)

2,922 Views
KRichard
Contributor II
Hello, what is a sensible way to keep track of time on ColdFire?

I would like to have the following things available:
- number of seconds since January 1, 1970 (UNIX time);
- number of ticks since boot.

I configured a PIT timer that triggers every milisecond and I increase a milisec counter variable, but I suspect there are better ways to do it.

Thanks,
Richard
Labels (1)
0 Kudos
4 Replies

481 Views
Technoman64
Contributor III
I use a Dallas/Maxim DS3234 RTC for timekeeping with Coldfire core. This device operates with 3.3 volt supply and has a SPI interface. Very accurate device with integrated tempuratue compensated crystal. Interface is simple and adding a power fail backup capacitor is easy. Device also has an interrupt output that can be programmed to intterupt once per second or using two internal alarms. Can be used in 24 hour or standrard 12 hour AM/PM mode. Upon power up it has an internal register/bit that indicates if it lost time due to power failure and/or backup capacitor discharging. Typical backup time is one week using a capacitor. A litium coin battery can be used for longer power fail situations.
 
I have basic QSPI interface routines I would share also. Let me know if you would like them and I will post.
 
This device can be purchased from Digikey for prototyping, it is NOT a cheap component. I buy in volume from a larger distributor with long lead times for better pricing for volume production.
 
Dennis
0 Kudos

481 Views
mjbcswitzerland
Specialist V
Richard

You didn't say which Coldfire you are using.
There are a few which have RTC built in to them...

Regards

Mark

www.uTasker.com

0 Kudos

481 Views
KRichard
Contributor II
Thank you for your answers, they were all very helpful (RTC is the keyword, now I know).

@Mark: you are right, after I read your message I searched for the RTC in the manual of my ColdFire (5373) and it has a builtin RTC indeed! :-D

@allawtterb: the CPU will never be reset. By the "ticks since boot" I mean a 32/16bit number that the processor increases periodically (I don't know if any such thing exist, I just ask!), and I know for example that 112 ticks is roughly 1 milisecond. If there were such a thing, then I wouldn't have to keep track of miliseconds by a timer. Sometimes I want to measure miliseconds in my sw.

@Technoman64: thanks for the detailed answer, my CF contains RTC so I'll stick to it atm.
0 Kudos

481 Views
allawtterb
Contributor IV
I haven't used any ColdFire cores yet, but this is a task I would usually leave for a external RTC.  For those that know more about ColdFires, it would be probably be useful to know the exact part you are using.
 
Will the CPU never be reset/have power removed?  How accurate do you need the secounds count to be?  What do you mean by "ticks since boot".
0 Kudos