When is 4.000MHz not 4.000MHz?

For discussing the 65xx hardware itself or electronics projects.
Post Reply
thedrip
Posts: 48
Joined: 02 Oct 2018

When is 4.000MHz not 4.000MHz?

Post by thedrip »

Not really a big issue, and not really looking to 'solve' it, just a peculiar observation.

Two SBCs of the same design, same board. One 65C02, one 65SC02.

Both systems running identical software, same hardware other than the CPU.

4.000 MHz can oscillators in both.

Time is kept with a 10ms timer from a 6522 triggering an NMI.

One system has lost 1s of time vs the other over the last 48 hours or so.

Very peculiar, and of no consequence to anyone or anything.

This seems well outside of the normal tolerance for Crystals to me, but checking the math again, maybe not!

Maybe I will hook the clock from one to the 2nd and run them off the same clock signal to see what happens.
Last edited by thedrip on Tue May 19, 2020 9:51 pm, edited 1 time in total.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Which is 4.000MHz not 4.000MHz?

Post by GARTHWILSON »

thedrip wrote:
One system has lost 1s of time vs the other over the last 48 hours or so.

Very peculiar, and of no consequence to anyone or anything.

This seems well outside of the normal tolerance for Crystals to me, but checking the math again, maybe not!

If they're truly specified for 4.000MHz, that's only four significant figures, whereas 1s after 48 hrs is more than five significant figures. Even if the oscillator frequency error were spec'ed to be <0.001%, 1s after 48 hrs would still be within spec. If it does become a problem, your time-keeping ISR could take in a correction factor where it adds or subtracts one tick for every so many.

Edit: Did you mean to make the title, "Re: When [not 'which'] is 4.000MHz not 4.000MHz?"? You can still edit it.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
thedrip
Posts: 48
Joined: 02 Oct 2018

Re: Which is 4.000MHz not 4.000MHz?

Post by thedrip »

GARTHWILSON wrote:
Edit: Did you mean to make the title, "Re: When [not 'which'] is 4.000MHz not 4.000MHz?"? You can still edit it.
Yes, yes I did. Thanks for the math clarification.
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: When is 4.000MHz not 4.000MHz?

Post by BigDumbDinosaur »

thedrip wrote:
Two SBCs of the same design, same board. One 65C02, one 65SC02...One system has lost 1s of time vs the other over the last 48 hours or so.
That's an error rate of 1 second in a 172,800 seconds period, or a drift of approximately 0.0005 percent. If you are using a 100ppm oscillator (a common part) that drift rate would be out-of-spec—maximum drift in a 100ppm oscillator would be 0.0001 percent. Just for grins, try swapping oscillators between the two units and note if the "error" moves with the one oscillator.

BTW, are you sure the interrupt generated by the VIA is being correctly processed? A occasional missed interrupt would cause your clock to gradually slow down.

Also, note that a 100ppm spec doesn't guarantee the oscillator is operating at the stated frequency. That spec refers to drift. The oscillator could be within its rated drift and just be oscillating a bit too slowly. Take a look at the data sheet and see what the percent accuracy is for the oscillator you are using.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
thedrip
Posts: 48
Joined: 02 Oct 2018

Re: When is 4.000MHz not 4.000MHz?

Post by thedrip »

I have 1 oscillator from Jameco, it kept perfect time for over 6 months. This 2nd oscillator is a China special. I think I know which one to suspect!

Like I said, no impact to anything, just funny to see two "identical" SBC's turn out to be not quite identical.
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: When is 4.000MHz not 4.000MHz?

Post by BigDumbDinosaur »

thedrip wrote:
I have 1 oscillator from Jameco, it kept perfect time for over 6 months. This 2nd oscillator is a China special. I think I know which one to suspect!

Like I said, no impact to anything, just funny to see two "identical" SBC's turn out to be not quite identical.
As with everything else, you only get what you pay for. You might be a little surprised to learn that the oscillator you got from Chinese vendor is a 500ppm part with questionable frequency accuracy.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
thedrip
Posts: 48
Joined: 02 Oct 2018

Re: When is 4.000MHz not 4.000MHz?

Post by thedrip »

Found a data sheet for what it's labelled as. I of course don't trust the label at all, but the datasheet calls it a +- 0.1% part, so no surprise that the time keeping isn't very accurate!

I have a 5 pack of these, some day I will put a them on a frequency counter and see just how far off nominal they are.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: When is 4.000MHz not 4.000MHz?

Post by BigEd »

It makes sense to me: for a lot of purposes, 1000ppm is enough, and it'll be easier to make, so it can be cheaper.
thedrip
Posts: 48
Joined: 02 Oct 2018

Re: When is 4.000MHz not 4.000MHz?

Post by thedrip »

If I didn't have two displays side by side, I wouldn't have noticed.

1 minute fast over 3-4 months? Close enough!
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: When is 4.000MHz not 4.000MHz?

Post by drogon »

thedrip wrote:
If I didn't have two displays side by side, I wouldn't have noticed.

1 minute fast over 3-4 months? Close enough!
Close enough, indeed! My microwave oven gains a minute a week...

Aaaaannndddd.... 3-4 months without hitting reset? That's (a) impressive, and (b) means you need to tinker more ;-)

Cheers,

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: When is 4.000MHz not 4.000MHz?

Post by BigDumbDinosaur »

thedrip wrote:
If I didn't have two displays side by side, I wouldn't have noticed.

1 minute fast over 3-4 months? Close enough!
That much drift isn't bad. I have a digital alarm clock here that loses about 5 minutes per month. Now, you'd think a clock plugged into line power would refer to the (very accurate) line frequency for a time base, but apparently not in this case.

BTW, I must've gotten lucky with the 3.6864 MHz oscillator that's in my POC V1.2 unit. According to the logic analyzer, the actual output frequency is 3686397 Hz, based upon a sample rate of 5ns. That's an accuracy of 99.9999 percent. That oscillator is the time base for both DUARTs, one of which generates a 100 Hz jiffy IRQ, which in turn, drives the system uptime and time-of-day software clocks. Assuming the oscillator doesn't drift, the uptime and time-of-day will be about 32 seconds slow over a one year period, an average loss of 2.67 seconds per month. Based upon past experience, that's actually better than the real-time clock accuracy of most server motherboards.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: When is 4.000MHz not 4.000MHz?

Post by BigDumbDinosaur »

drogon wrote:
thedrip wrote:
If I didn't have two displays side by side, I wouldn't have noticed.

1 minute fast over 3-4 months? Close enough!
Close enough, indeed! My microwave oven gains a minute a week...

That means when you pop some popcorn it gets done a little sooner. :D

Quote:
Aaaaannndddd.... 3-4 months without hitting reset? That's (a) impressive, and (b) means you need to tinker more ;-)

http://forum.6502.org/viewtopic.php?f=4&t=1457&start=270#p29284
x86?  We ain't got no x86.  We don't NEED no stinking x86!
thedrip
Posts: 48
Joined: 02 Oct 2018

Re: When is 4.000MHz not 4.000MHz?

Post by thedrip »

My uptimes aren't nearly as impressive. My machine sits in a BASIC loop redrawing Mandelbrot sets in different colors.

My not nearly as impressive or informative Youtube video.
https://www.youtube.com/watch?v=5WBXG1EIiCY
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: When is 4.000MHz not 4.000MHz?

Post by BigDumbDinosaur »

thedrip wrote:
My uptimes aren't nearly as impressive. My machine sits in a BASIC loop redrawing Mandelbrot sets in different colors.

My not nearly as impressive or informative Youtube video.
https://www.youtube.com/watch?v=5WBXG1EIiCY
The Mandelbrot display looks pretty good. Considering the math that is involved and the fact that the grunt work is being done in a BASIC interpreter, performance is certainly acceptable for a 4 MHz machine.

A fun exercise would be to work out how to do the same in assembly language and see how much of a speed-up occurs.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
thedrip
Posts: 48
Joined: 02 Oct 2018

Re: When is 4.000MHz not 4.000MHz?

Post by thedrip »

Borrowed a frequency counter, just to see...

The original oscillator I was using comes out at 3,999,940+-20 Hz.. max error of 15PPM is pretty acceptable.

The "questionable" Chinese oscillator has never been lower than 3,999,980 and usually hangs out in the 3,999,998 range, depending on room temp. I would say that 5PPM in a 20 degree temp range (65-85F) is perfectly good for ebay possibly-relabeled parts!
Post Reply