ddrown / pps-gmtimer

Linux kernel module PPS Client Driver using OMAP Timer hardware
15 stars 14 forks source link

Beaglebone Black Hardware Counter Capture Driver

Building the kernel

make ARCH=arm oldconfig make ARCH=arm zImage make ARCH=arm modules

Building the module

The makefile assumes the kernel sources are in ../linux. If this is incorrect, change the KDIR variable

to build the module, type: make

Installing the Device Tree Overlay

on the BBB:

Using an external oscillator (TCLKIN)

To use an external clock source on pin P9.41 (TCLKIN). It accepts up to a 24MHz clock.

To use this clock as your system time source:

echo timer4 > /sys/devices/system/clocksource/clocksource0/current_clocksource

If you're not using the timer4 hardware, use the other timer's name in place.

To switch back to the default time source:

echo gp_timer > /sys/devices/system/clocksource/clocksource0/current_clocksource

Monitoring operation

The sysfs files in /sys/devices/ocp.3/pps_gmtimer.* contain the counter's current state:

The program "watch-pps" will watch these files and produce an output that looks like:

1423775690.000 24000010 169 0.000007041 0 3988681035 -0.000001434

The columns are: pps timestamp, capture difference, cycles between capture and interrupt, interrupt_delta, raw capture value, offset