Page 1 of 1

Delay Calibration

Posted: Thu Sep 21, 2006 9:24 am
by Jeko
How can I calibrate the delay?

Posted: Thu Sep 21, 2006 6:52 pm
by carbonBased
You have a timer interrupt, that you can control how often it fires. You should be able to use this to time a specific chunk of code that will be repeated inside a high resolution timing function (if high resolution isn't required, the timer interrupt should be used, and the task should be blocked until approx. the number of ticks have elapse).

The code segment that's used to repeat, however, needs to be selectively chosen. The linux kernel, at one point, would real from a specific port for approx a 1us delay. This is fairly consistent. A trail of nop's, however, probably wouldn't be. The loop would eventually get cached, and therefore speed up.

--Jeff

PS: I don't know that this is how Linux, etc, calibrate delay loops... just a thought.