| |
chatGPZ
Registered: Dec 2001 Posts: 11378 |
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: 11378 |
Quote:that's totally out of scope of the discussion. of course we are assuming a standard DOS formatted disk.
the thread is about comparing how accurate the two methods are, not how you can make them fail using non standard disks. please stick to the topic. you still havent explained some of your claims regarding accuracy.
tlr: eg you could put two sector 0 headers after each other, and only one of them is followed by a data block - that will work fine (for reading at least). copy protections used this, as a simple copier will not recreate this. |
| |
Zibri Account closed
Registered: May 2020 Posts: 304 |
Quoting Groepaz
the thread is about comparing how accurate the two methods are, not how you can make them fail using non standard disks. please stick to the topic. you still havent explained some of your claims regarding accuracy
Mine are not "claims".
The proof is my program itself and no progranm before that could accomplish the same results including yours.
Even after the modifications.
I even tested your programs since you clearly didn't even take the time to test them before committing them.
The screenshots are more than eloquent.
I repeat: I have nothing to prove nor to explain to you nor anybody else. If you wanted to learn something you use the worst attitude to do so.
Sorry, but I really am not in the mood to be teaching anything to you. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11378 |
So i take it that you can not explain why one method is supposed to be more accurate than the other, nor explain why the explanation in post #30 is false. Repeating the same claims over and over does not help, nor prove anything. Forget my program, my program (or anyone elses) is irrelevant for explaining how accurate yours is. |
| |
Zibri Account closed
Registered: May 2020 Posts: 304 |
Quote: So i take it that you can not explain why one method is supposed to be more accurate than the other, nor explain why the explanation in post #30 is false. Repeating the same claims over and over does not help, nor prove anything. Forget my program, my program (or anyone elses) is irrelevant for explaining how accurate yours is.
Bite me.
Live with it. |
| |
Zibri Account closed
Registered: May 2020 Posts: 304 |
If anyone is interested some made even a video tutorial (in italian, but automatic sbutitles seem to work about fine).
https://www.youtube.com/watch?v=p87sw33byYY |
| |
Compyx
Registered: Jan 2005 Posts: 631 |
"Some" |
| |
chatGPZ
Registered: Dec 2001 Posts: 11378 |
Pretty cool, he even let you work on his drive! |
| |
Rebok
Registered: Apr 2017 Posts: 10 |
Zibri, what about the station 1541-II. Is there a similar way to adjust? |
| |
chatGPZ
Registered: Dec 2001 Posts: 11378 |
Take off the top cover, the pot is on the small motor control board |
| |
Hoogo
Registered: Jun 2002 Posts: 105 |
I know how to double the accuracy.... |
Previous - 1 | ... | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ... | 28 - Next |