> >> How does the pulse trigger the capture ? If some hardware line is >> polled, >> how frequent is that polling ? The counter units may well be >> nanoseconds, >> but the inherent uncertainty of the polling instant must be taken into >> account. > >> If instead there is no polling, but it is a hardware triggering, then >> could >> you please give more details ? Thanks. > > The code we are talking about was originally intended to let NTP support > PPS > signals. > > The idea is that the kernel grabs a time stamp in the interrupt routine. > The > user can poll or wait for the next event. > > The details are in > RFC 2783 - Pulse-Per-Second API for UNIX-like Operating Systems > March 2000 > http://www.faqs.org/rfcs/rfc2783.html > > Linux and *BSD generally support it. (For Linux, you need a recent > kernel.) > Details may vary. Check the source etc. It's probably an option when > building the kernel and may not be turned on with the default > distribution.
It can be done entirely from user space as well. Some years ago I modified Jonathan Buzzards radioclkd-shm NTP interface. http://www.buzzard.me.uk/jonathan/radioclock.html *********************** /* wait till a serial port status change interrupt is generated */ if (ioctl(fd, TIOCMIWAIT, TIOCM_CD | TIOCM_CTS | TIOCM_DSR)!=0) return -1; gettimeofday(tv, NULL); if (ioctl(fd, TIOCMGET, &arg)!=0) return -1; ************************ The TIOCMIWAIT ioctl gives the core functionality. As seen above you can get (and separate) interrupts from DCD, CTS and DSR-pins on a real serial port. All three phases can be timetagged on one serial port. Have not tested USB2serials. Run the test mode - 'radioclkd --test' - and modify the code for your setup. I tested repetition rates up to 10kHz on an embedded P3 600MHz ULV SBC. Timestamps from a GPS locked 100Hz had most better than 10us and >>90% better than 100us. Very few outliers up to a few ms error. Kernel was a 2.4.30-ish with nano-patches. The SBC was running NTP with kernel mode PPS. -- Björn _______________________________________________ time-nuts mailing list -- time-nuts@febo.com To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts and follow the instructions there.