Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > 1541/c64 clock ratio, crystal accuracy
2016-07-18 10:27
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.
2016-07-18 12:56
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.
2016-07-18 13:13
ChristopherJam

Registered: Aug 2004
Posts: 1409
Ouch. Ok, sync every few bytes it is. Thank you!
2016-07-18 13:28
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.
2016-07-18 14:08
chatGPZ

Registered: Dec 2001
Posts: 11386
now make a patch for VICE that makes it customizable :)
2016-07-18 16:57
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.
2016-07-18 18:19
chatGPZ

Registered: Dec 2001
Posts: 11386
yes indeed - i know at least one other person who is currently fighting with this :)
2016-07-18 18:27
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.
2016-07-19 07:10
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
2016-07-19 10:44
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.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
zscs
Wolk/Software of Swe..
Paladin/G★P
iAN CooG/HVSC
Flashback
wil
LightSide
St0rmfr0nt/Quantum
RetroGL
Nith/TRIɅD
Guests online: 78
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.7)
4 Acidchild  (9.7)
5 Cash  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.068 sec.