| |
chatGPZ
Registered: Dec 2001 Posts: 11377 |
Accurately Measuring Drive RPM
To bring the discussion from 1541 Speed Test into the forum....
first lets recapitulate:
The general idea is: have a "marker" on a track, then measure the time for one revolution using timers. Generally there are different ways to achieve this:
- wait for the marker and toggle a IEC line. the C64 measures the time using CIA timer. this is what eg the well known "Kwik Load" copy does, the problem is that it is PAL/NTSC specific, and it can never be 100% exact due to the timing drift between drive and C64.
- wait for the marker and measure the time using VIA timers on the drive. the problem with this is that VIA timers are only 16bit and can not be cascaded, so you either have to measure smaller portions at a time, or rely on the wraparound and the value being in certain bounds at the time you read it.
now, to make either way slightly more accurate, a special kind of reference track can be used. typically this track will contain nothing except one marker - which makes the code a bit simpler and straightforward. this is what 1541 Speed Test does. the DOS also does something similar when formatting, to calculate the gaps. This obviosly has the problem that we are overwriting said track.
Now - the question isn't how to do all this, that's a solved problem. The question is, given a specific implementation, how *accurate* is it actually, and why?
The basic math to calculate the RPM is this:
expected ideal:
300 rounds per minute
= 5 rounds per second
= 200 milliseconds per round
at 1MHz (0,001 milliseconds per clock)
= 200000 cycles per round
to calculate RPM from cycles per round:
RPM = (200000 * 300) / cycles
two little test programs are here: https://sourceforge.net/p/vice-emu/code/HEAD/tree/testprogs/dri.. ... the first reads timer values between each sector header and then the total time for a revolution is accumulated from the delta times. the second leaves the timer running for one revolution and then indirectly gets the time for a revolution from that. to my own surprise, both appear to be accurate down to 3 cycles (in theory the second one should be more accurate, at least thats what i thought. i also expected some more jitter than just 3 cycles)
1541 Speed Test writes a track that contains one long sync, and then 5 regular bytes which serve as the marker. it then reads 6 bytes and measures the time that takes, which equals one revolution. somehow this produces a stable value without any jitter, which was a bit surprising to me too (i expected at least one cycle jitter, due to the sync waiting loops) (i am waiting for the source release and will put a derived test into the vice repo too)
So, again, the question is... how accurate are those and why? (a stable value alone does not tell its accurate). Some details are not quite clear to me, eg if we are writing a reference track, how much will that affect the accuracy of the following measurement? how will the result change when the reference track was written at a different speed than when doing the measuring? Will using a certain speedzone make it more or less accurate?
Bonus question: can we use https://en.wikipedia.org/wiki/Chinese_remainder_theorem with two VIA timers to make this more accurate? or is it a pointless exercise? |
|
... 263 posts hidden. Click here to view all posts.... |
| |
chatGPZ
Registered: Dec 2001 Posts: 11377 |
And don't forget the temperature drift, of which Unseen provided a nice diagram
And yes, language barrier is/was kindof obvious :) |
| |
tlr
Registered: Sep 2003 Posts: 1787 |
Quoting GroepazAnd don't forget the temperature drift, of which Unseen provided a nice diagram
Good point. It affects the accuracy as well. It probably won't affect the ability to assess the belt though as the curve doesn't seem to move very much per typical rotation, at least not after the first minute or so.
BTW I notice I've swapped the +100ppm and -100ppm in my calculation above, but fortunately it only results in the results swapped. My bad! |
| |
ChristopherJam
Registered: Aug 2004 Posts: 1409 |
Quoting Krill So even getting rid of the smaller part is the pointless demoscene thing to do, just because! :D
True enough. I mostly wanted to point out that the variation in crystal speed is an even bigger factor if "accuracy" is the issue.
As TLR has already come at from the opposite direction, Zibri's target error of <0.01RPM amounts to 30ppm, so stats on actual crystal variation will tell us whether his dream is even possible in practice.
Quote:That said, a simple way to get down from 2 cycles jitter to 1 cycle is using a chain of 18-ish "BVS readtimer" instead of "BVC *". (Or 11-ish NOPs plus 7-ish BVS in the red zone, you get the idea.)
Will give either 0-cycle delay (spot on) or be 1 cycle late.
True! And damn, I'd been meaning to post that ;-) |
| |
ChristopherJam
Registered: Aug 2004 Posts: 1409 |
Quoting ZibriAny accuracy below the 2 digits is not enough to assess the status of the belt or mechanics and disk.
I'm curious about this claim. I've been assuming that loaders need to be tolerant of anything from 295 to 305 RPM, in which case even 1 digit is somewhat overkill.
Have I been wrong all this time, in which case surely it would be safe to relax the GCR restrictions to allow runs of three zeros instead of just two? :) |
| |
tlr
Registered: Sep 2003 Posts: 1787 |
Quoting ChristopherJamAs TLR has already come at from the opposite direction, Zibri's target error of <0.01RPM amounts to 30ppm, so stats on actual crystal variation will tell us whether his dream is even possible in practice.
That would be +/- 15ppm in crystal-speak, but yeah.
And measuring that requires non-trivial equipment. Where should we send all our drives... ;) |
| |
tlr
Registered: Sep 2003 Posts: 1787 |
Quoting ChristopherJamQuoting ZibriAny accuracy below the 2 digits is not enough to assess the status of the belt or mechanics and disk.
I'm curious about this claim. I've been assuming that loaders need to be tolerant of anything from 295 to 305 RPM, in which case even 1 digit is somewhat overkill.
I read that claim as, by watching how much the lower digits flicker around something can be said about belt slippage and things like that (this would be "precision"). Loader speed tolerance would normally be accounting for the "accuracy" of the rotational speed.
As for the presentation, I still think some kind of plot would be useful for quick adjustment. Think: Recorder-Justage [german] or HeadAlign 1.1. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11377 |
histogram would tell quite nicely how bad the "wobble" is... less than trivial to implement unfortunately :) |
| |
tlr
Registered: Sep 2003 Posts: 1787 |
Quote: histogram would tell quite nicely how bad the "wobble" is... less than trivial to implement unfortunately :)
I think plotting instantaneous vs running average (5 laps maybe) in the same graph would do. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11377 |
probably... not quite as nice, but sure... :) also a simple scrolling scatter plot like recorder justage does seems interesting enough. |
| |
Zibri Account closed
Registered: May 2020 Posts: 304 |
Quoting ChristopherJamQuoting ZibriAny accuracy below the 2 digits is not enough to assess the status of the belt or mechanics and disk.
I'm curious about this claim. I've been assuming that loaders need to be tolerant of anything from 295 to 305 RPM, in which case even 1 digit is somewhat overkill.
Have I been wrong all this time, in which case surely it would be safe to relax the GCR restrictions to allow runs of three zeros instead of just two? :)
You are not wrong at all. I even wrote it in the instructions.
A drive works even when set to 290 RPM! |
Previous - 1 | ... | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 - Next |