| |
ChristopherJam
Registered: Aug 2004 Posts: 1409 |
1541/c64 clock ratio, crystal accuracy
Does anyone know the tolerances on the c64 and 1541 clock crystals?
If I let a test loop run on the drive for 14847 cycles in x64sc, then according to the monitor, 14637 cycles elapse in the c64.
Given a c64 clock speed of 17.734475MHz/18= 985248 Hz, and a 1541 clock speed of 1.0MHz exactly I would have expected only 14628 cycles to elapse on the c64 side.
It's only different by 0.06%, but that's enough to throw out a one-sync-per-packet transfer. It occurs to me that the crystal tolerances on the real thing may be worse than that. If so, I'll just have to sync more often. |
|
| |
Zer0-X Account closed
Registered: Aug 2008 Posts: 78 |
There's also a trimmer for the crystal inside C64 used to finetune the frequency for correct color output. Add that to the tolerances and what variation the temperature plays. |
| |
ChristopherJam
Registered: Aug 2004 Posts: 1409 |
Ouch. Ok, sync every few bytes it is. Thank you! |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
Yes, those tolerances seem fairly reasonable given the generation of technology. +/- 300ppm wasn't an unreasonable spec for a given crystal, maybe even worse.
I believe temperature is a fairly small factor so this frequency difference won't change very quickly. You could possibly measure the difference in some way and generate speed code accordingly. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
now make a patch for VICE that makes it customizable :) |
| |
ChristopherJam
Registered: Aug 2004 Posts: 1409 |
tlr - interesting idea about profiling the hardware the loader is running on; it'd be pretty easy to make the loop timing adaptable, and even checking after each transfer whether the timing has drifted
gpz - heh, must admit I've already started hunting for the code that coordinates the different speeds; it would be hella useful for checking transfer robustness. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
yes indeed - i know at least one other person who is currently fighting with this :) |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
ChristopherJam: Yeah, I think it should be doable. Unfortunately I have been too lazy to prototype it myself.
I wonder how good it would get? Temp + general jitter will never disappear but as I stated above I believe it's a minor component. |
| |
Bitbreaker
Registered: Oct 2002 Posts: 508 |
I would not at all rely on anything that is named tolerance on real hardware. I have come across quite some worn out hardware that is out of the expected specs, most of all, when getting warm. Allow as much tolerance as possible i'd say, or you injure yourself so very often :-) Also have always a capable psychiatrist at hand in case of a mental breakdown after hundreds of failing attempts on real hardware, while it just worked so fine on vice or 1541U :-D |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
Yes, I know what you mean. My DMA disk writer for the DTV mysteriously fails on some drives. Never really figured out what is wrong. It worked on enough drives to satisfy demo development needs at least.
To do any serious calibrating scheme would ideally include profiling a large set of units for drift and jitter. Preferably in a controlled temp chamber. |