Mark Butcher

M5223X RTC details

Discussion created by Mark Butcher on Aug 11, 2007
Latest reply on Aug 12, 2007 by Mark Butcher
Hi All

I am just integrating a driver interface to use the RTC in the M5223X.

Since I haven't used it just yet I thought that may be someone who has can answer a couple of points which are not totally clear from the documentation...

1. I would like to be able to read back the time. This involves reading three registers (seconds, hours_minutes, days).
There is a small risk involved because whilst reading one of them it could be possible that others get incremented due to the fact that a 1Hz clock arrives between instructions.
Therefore I will try disabling the RTC during the read sequence and re-enabling it again afterwards.
Will this work or will disabling cause side effects (apart from possibly losing a 1 Hz tick?)

2. I have seen that the set up of the RTC 1Hz rate is given in the example as:
        MCF_CLOCK_RTCDR = 48000000;  /* device dependent */

I think that the oscillator clock is required and not the PLL rate (?)

The M5223X has (always) 25MHz so 25000000 would seem appropriate. However I have also read that the value 0 disables the clock and the divide value is one more that the register value.

This would suggets that the best setting would be (25000000 - 1) - or in the example case (48000000 - 1).

Have I understood this correctly?

Apart from those points it seems quiet straight forward. Or is there anything else to watch out for?