Reply by Ken Lee April 12, 20042004-04-12
On Tue, 06 Apr 2004 05:39:43 GMT, postmaster@noname.com (Ken Lee)
wrote:

<-- Purposely top-posted -->

Thankyou everyone for your comments. 

One common theme was that many thought that the RTC was read too
often. I got some response back (via our distributor) from a Philips
engineer who said the same thing but without any technical
clarification. In any case I re-jigged my test to read the RTC every
100ms and it has been running perfectly now for 4 days. This must be
some unwritten law as I went through the data sheet again in the hope
of finding this constraint -- but without any luck.

So this appears to be the root of the problem - thanks again for
everyone's contributions.

Ken.

>Hi, > I'm just wondering if anybody has had any problems with the >Philips PCF8563 RTC. I've devised a simple unit test which does the >following: > >1. RTC seconds, minutes and hours registers are initialised to zero. >2. Continuously samples the RTC (at 1 millisecond) and reads the >seconds, minutes and hours registers >3. Each register has an associated counter in software, which is >incremented if the value changes. Note that a change of value causes >an increment of the counter. >4. The read RTC registers and the associated counter values are then >displayed. > >Note that the appropriate register masks are applied to ensure only >valid time values are read. Also this test is independant of the RTC >crystal accuracy and the micro crystal accuracy. > >After running the test for a weekend the 2 values are out by 3 >seconds. > >The only reason why I'm running such extensive tests is that in our >product which uses this RTC, we are getting as much as 6 hours >discrepancies in our data logs (over a longer period of time). The >data logs are timestamped from RTC readings and NOT by the micro >system clock. > >Also in conjunction with the above test we have attached an external >reference clock which is driven directly from the 32.768kHz from the >CLKOUT of the PCF8563 and this also indicates a 3 second discrepancy. > >Now this is very baffling. We've checked the oscillator circuit and >it's per the PCF8563 data sheet. Also the test has been repeated on 3 >separate units with the same result. If I didn't know better I'd say >that the internal counters of the PCF8563 were hiccupping -- is this >possible. > >Any help or suggestions welcomed. > >Ken. > >+====================================+ >I hate junk email. Please direct any >genuine email to: kenlee at hotpop.com
+====================================+ I hate junk email. Please direct any genuine email to: kenlee at hotpop.com
Reply by Anton Erasmus April 9, 20042004-04-09
On Tue, 06 Apr 2004 05:39:43 GMT, postmaster@noname.com (Ken Lee)
wrote:

>Hi, > I'm just wondering if anybody has had any problems with the >Philips PCF8563 RTC. I've devised a simple unit test which does the >following: > >1. RTC seconds, minutes and hours registers are initialised to zero. >2. Continuously samples the RTC (at 1 millisecond) and reads the >seconds, minutes and hours registers >3. Each register has an associated counter in software, which is >incremented if the value changes. Note that a change of value causes >an increment of the counter. >4. The read RTC registers and the associated counter values are then >displayed. > >Note that the appropriate register masks are applied to ensure only >valid time values are read. Also this test is independant of the RTC >crystal accuracy and the micro crystal accuracy. > >After running the test for a weekend the 2 values are out by 3 >seconds. > >The only reason why I'm running such extensive tests is that in our >product which uses this RTC, we are getting as much as 6 hours >discrepancies in our data logs (over a longer period of time). The >data logs are timestamped from RTC readings and NOT by the micro >system clock. > >Also in conjunction with the above test we have attached an external >reference clock which is driven directly from the 32.768kHz from the >CLKOUT of the PCF8563 and this also indicates a 3 second discrepancy. > >Now this is very baffling. We've checked the oscillator circuit and >it's per the PCF8563 data sheet. Also the test has been repeated on 3 >separate units with the same result. If I didn't know better I'd say >that the internal counters of the PCF8563 were hiccupping -- is this >possible. > >Any help or suggestions welcomed.
Are the 32.768kHz crystals low capacitance types ? Many/most of the cheap 32.768kHz crystals are in the order of 12pF, and many of the RTC devices want the 6pF 32.768kHz crystals. Since we have started being very carefull in making sure that the 32.768kHz crystals we buy are the low capacitance types, we have had much better accuracy from the RTC devices we use. Regards Anton Erasmus
Reply by mike April 7, 20042004-04-07

Tim Mitchell wrote:

> In article <407325e1.1382545703@news.individual.net>, Ken Lee > <postmaster@noname.com> writes > >> On Tue, 06 Apr 2004 10:09:28 +0200, Wolfgang Mahringer >> <yeti201@gmx.at> wrote: >> >>> Hi Ken, >>> >>> Ken Lee wrote: >>> >>>> 1. RTC seconds, minutes and hours registers are initialised to zero. >>>> 2. Continuously samples the RTC (at 1 millisecond) and reads the >>>> seconds, minutes and hours registers >>> >>> >>> I haven't done anything with this RTC chip, but: >>> you should not read a RTC so often. >>> Read it only once a second or so. >>> >>> A closer look in the datasheet of the PCF8563 may reveal, >>> that rollover of RTC counters is inhibited for a short period of time >>> after the first access. This is to prevent erroneous reading. >>> >>> HTH >>> Wolf >> >> >> Hi Wolfgang, >> Thanks for the response. The data sheet does say that the >> counters are "frozen" during a read, but I would assume that these >> counters were double buffered so as not to lose counts. Anyway I'll >> continue with my investigations. >> > I've used this RTC a lot but never had these problems; however, I only > read it about every 100 msec. In my applications it keeps time better > than 1sec per month. I would suspect that your very frequent reading of > the registers may have something to do with it.
We use the PCF8593 (previous generation, but I believe the oscillator is similar), and have never had any trouble. Once trimmed, we too get about 1 sec per month. Untrimmed, we routinely see the clock running about 20ppm fast, which corresponds closely to the 3 sec per weekend the OP quotes. Our application reads the clock infrequently, but an earlier version read it every 200msec, again with no trouble. Mike L.
Reply by Tim Mitchell April 7, 20042004-04-07
In article <407325e1.1382545703@news.individual.net>, Ken Lee 
<postmaster@noname.com> writes
>On Tue, 06 Apr 2004 10:09:28 +0200, Wolfgang Mahringer ><yeti201@gmx.at> wrote: > >>Hi Ken, >> >>Ken Lee wrote: >>> 1. RTC seconds, minutes and hours registers are initialised to zero. >>> 2. Continuously samples the RTC (at 1 millisecond) and reads the >>> seconds, minutes and hours registers >> >>I haven't done anything with this RTC chip, but: >>you should not read a RTC so often. >>Read it only once a second or so. >> >>A closer look in the datasheet of the PCF8563 may reveal, >>that rollover of RTC counters is inhibited for a short period of time >>after the first access. This is to prevent erroneous reading. >> >>HTH >>Wolf > >Hi Wolfgang, > Thanks for the response. The data sheet does say that the >counters are "frozen" during a read, but I would assume that these >counters were double buffered so as not to lose counts. Anyway I'll >continue with my investigations. >
I've used this RTC a lot but never had these problems; however, I only read it about every 100 msec. In my applications it keeps time better than 1sec per month. I would suspect that your very frequent reading of the registers may have something to do with it. -- Tim Mitchell
Reply by CBFalconer April 7, 20042004-04-07
Ken Lee wrote:
> Wolfgang Mahringer <yeti201@gmx.at> wrote: >> Ken Lee wrote: >> >>> 1. RTC seconds, minutes and hours registers are initialised to zero. >>> 2. Continuously samples the RTC (at 1 millisecond) and reads the >>> seconds, minutes and hours registers >> >> I haven't done anything with this RTC chip, but: >> you should not read a RTC so often. >> Read it only once a second or so. >> >> A closer look in the datasheet of the PCF8563 may reveal, that >> rollover of RTC counters is inhibited for a short period of time >> after the first access. This is to prevent erroneous reading. >> > Thanks for the response. The data sheet does say that the > counters are "frozen" during a read, but I would assume that > these counters were double buffered so as not to lose counts. > Anyway I'll continue with my investigations.
You can avoid any nasty interactions by reading the registers least to most significant, and then rereading the least significant. If it hasn't changed no rollover has occured, else go around again. -- Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net) Available for consulting/temporary embedded and systems. <http://cbfalconer.home.att.net> USE worldnet address!
Reply by Jim Granville April 6, 20042004-04-06
Ken Lee wrote:
> Hi, > I'm just wondering if anybody has had any problems with the > Philips PCF8563 RTC. I've devised a simple unit test which does the > following: >
<snip>
> Also in conjunction with the above test we have attached an external > reference clock which is driven directly from the 32.768kHz from the > CLKOUT of the PCF8563 and this also indicates a 3 second discrepancy.
Can you clarify that more, as that sounds 'almost direct to the crystal' (no dividers, only buffered), which would indicate problems are not in the counter chain, but could be more like clock noise effects. Also, is the delta faster, or slower ? -jg
Reply by Ken Lee April 6, 20042004-04-06
On Tue, 06 Apr 2004 10:09:28 +0200, Wolfgang Mahringer
<yeti201@gmx.at> wrote:

>Hi Ken, > >Ken Lee wrote: >> 1. RTC seconds, minutes and hours registers are initialised to zero. >> 2. Continuously samples the RTC (at 1 millisecond) and reads the >> seconds, minutes and hours registers > >I haven't done anything with this RTC chip, but: >you should not read a RTC so often. >Read it only once a second or so. > >A closer look in the datasheet of the PCF8563 may reveal, >that rollover of RTC counters is inhibited for a short period of time >after the first access. This is to prevent erroneous reading. > >HTH >Wolf
Hi Wolfgang, Thanks for the response. The data sheet does say that the counters are "frozen" during a read, but I would assume that these counters were double buffered so as not to lose counts. Anyway I'll continue with my investigations. Ken. +====================================+ I hate junk email. Please direct any genuine email to: kenlee at hotpop.com
Reply by Wolfgang Mahringer April 6, 20042004-04-06
Hi Ken,

Ken Lee wrote:
> 1. RTC seconds, minutes and hours registers are initialised to zero. > 2. Continuously samples the RTC (at 1 millisecond) and reads the > seconds, minutes and hours registers
I haven't done anything with this RTC chip, but: you should not read a RTC so often. Read it only once a second or so. A closer look in the datasheet of the PCF8563 may reveal, that rollover of RTC counters is inhibited for a short period of time after the first access. This is to prevent erroneous reading. HTH Wolf -- From-address is Spam trap Use: wolfgang (dot) mahringer (at) sbg (dot) at
Reply by Ken Lee April 6, 20042004-04-06
Hi,
	I'm just wondering if anybody has had any problems with the
Philips PCF8563 RTC. I've devised a simple unit test which does the
following:

1. RTC seconds, minutes and hours registers are initialised to zero.
2. Continuously samples the RTC (at 1 millisecond) and reads the
seconds, minutes and hours registers
3. Each register has an associated counter in software, which is
incremented if the value changes. Note that a change of value causes
an increment of the counter.
4. The read RTC registers and the associated counter values are then
displayed.

Note that the appropriate register masks are applied to ensure only
valid time values are read. Also this test is independant of the RTC
crystal accuracy and the micro crystal accuracy.

After running the test for a weekend the 2 values are out by 3
seconds. 

The only reason why I'm running such extensive tests is that in our
product which uses this RTC, we are getting as much as 6 hours
discrepancies in our data logs (over a longer period of time). The
data logs are timestamped from RTC readings and NOT by the micro
system clock.

Also in conjunction with the above test we have attached an external
reference clock which is driven directly from the 32.768kHz from the
CLKOUT of the PCF8563 and this also indicates a 3 second discrepancy.

Now this is very baffling. We've checked the oscillator circuit and
it's per the PCF8563 data sheet. Also the test has been repeated on 3
separate units with the same result. If I didn't know better I'd say
that the internal counters of the PCF8563 were hiccupping -- is this
possible.

Any help or suggestions welcomed.

Ken.

+====================================+
I hate junk email. Please direct any 
genuine email to: kenlee at hotpop.com