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

Dan Drown dan-timenuts at drown.org
Tue Dec 2 16:26:17 EST 2014


Quoting Iain Young <iain at g7iii.net>:
:
> 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 ?

In theory it should support multiple timers, each with their own  
/dev/ppsX file.  I haven't tested that part yet, though :)

The timer hardware to use is selected with the device tree overlay.   
Creating multiple pps-gmtimer device tree elements, each with their  
own timer should be possible.  I'm not sure how much having two or  
more timer capture interrupts at the same time will affect timing  
accuracy.  That's also something that needs experimenting with.  The  
calculation of when the event happened is done in the interrupt  
handler, and it subtracts how long ago the event happened from the  
current time.  Since I'm not currently adjusting for local clock  
speed, this adds 1 nanosecond of error for every 17 microseconds the  
interrupt is delayed (assuming 60ppm local clock error).

> 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 ?

It should be pretty easy to switch to TCLKIN, the function  
"omap_dm_timer_set_source" is already there for it.  Either the main  
timer used for the system clock (in arch/arm/mach-omap2/timer.c) or  
this module could be changed to use TCLKIN.  If this module was  
extended to also be a clocksource, it could be used for system time as  
well.

I don't have any hardware to experiment with TCLKIN on hand, so I  
won't be doing that this month at least.


More information about the time-nuts mailing list