[time-nuts] Beaglebone Black driver for hardware timer capture

Iain Young iain at g7iii.net
Tue Dec 2 14:49:58 EST 2014

Hey Dan,

You Wrote:

> I wrote a kernel driver for the BBB timer hardware. It produces pps events for things like ntpd to consume. The source for it is at https://github.com/ddrown/pps-gmtimer
> A side effect of this driver is it measures the interrupt latency and jitter on the BBB hardware. The attached file interrupt-latency.png contains an interrupt latency histogram and cumulative distribution function. This interrupt latency should be similar to what the pps-gpio driver experiences on this hardware. The difference is the timer hardware driver can remove the effects of the interrupt latency.
> The graphs of offset over 7 days worth of samples don't show a huge difference. The *-timer.png file is from pps-gmtimer and the *-gpio.png file is from pps-gpio.  The stddev of the offsets are 244ns from the gpio run and 143ns from the timer run.

Great work. I will have to try this driver, I've been using the FreeBSD
equivalent, it's good to see someone has actually done the Linux version
as well now. That will be anoĊ§her Christmas/New Year project!

> The BBB hardware supports hardware IEEE1588/PTP timestamps, so people might be interested in that as well. The driver for it is already in Linux, but not enabled in the default BBB kernel config.

Indeed, this support is still missing in FreeBSD, and the PRU support is
much more mature on linux (although it does work on FreeBSD, I had some
issues with working out what was going on at times, but that might well
have been operator error without time to debug)

> Let me know if you have any questions.

Is your code able to support multiple inputs simultaneously ? FreeBSD's
doesn't due to some architecture issue with the timing subsystem as I
understand it.

Or is it like the FreeBSD code, and I have to select exactly one of
TIMER4-TIMER7 input pins to drive the PPS ?

The Beaglebone also has the facility for an external clock input. Are
you planning on doing any work in order to get the Linux kernel to
select the TCLKIN as the clock ?

Best Regards


More information about the time-nuts mailing list