Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 04 Mar 2016 11:00:08 -0700
From:      Ian Lepore <ian@freebsd.org>
To:        Karl Denninger <karl@denninger.net>, freebsd-stable@freebsd.org
Subject:   Re: PPS input on a generic GPIO pin on Raspberry Pi.
Message-ID:  <1457114408.13785.150.camel@freebsd.org>
In-Reply-To: <56D9BDB6.6040903@denninger.net>
References:  <8C90C80B-AC5F-4B12-8E84-84193B8C55C4@pean.org> <56D9BDB6.6040903@denninger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2016-03-04 at 10:54 -0600, Karl Denninger wrote:
> On 3/3/2016 12:57, Peter Ankerstål wrote:
> > Hi!
> > 
> > I have sort of exactly the same question as Erik:
> > http://lists.freebsd.org/pipermail/freebsd-questions/2014-July/2590
> > 55.html
> > 
> > I have bought a https://learn.adafruit.com/adafruit-ultimate-gps an
> > d want to use the PPS output to discipline my clock.
> > 
> > But the only source of information on how PPS works in FreeBSD I
> > could find is this: 
> > https://docs.freebsd.org/doc/8.0-RELEASE/usr/share/doc/ntp/pps.html
> >  and it clearly states the two ways to provide a PPS signal. "The
> > PPS signal can be connected in either of two ways: via the data
> > carrier detector (DCD) pin of a serial port or via the acknowledge
> > (ACK) pin of a parallel port¡
> > 
> > Since the Pi doesnÿt have any DCD pin i would like to use a generic
> > GPIO for this. There is a linux kernel module for this: http://lxr.
> > free-electrons.com/source/drivers/pps/clients/pps-gpio.c?v=3.6
> GPIO is supported on the Pi, I'm using it on 11-Current on my home
> control software to drive relays on my pool hardware (e.g. valves,
> heater, VFD motor drive, etc) and it is working very well.  I don't
> believe tapping into that at the kernel level to expose a pps signal
> (e.g. on /dev/pps or something of the like) would be very difficult
> at
> all, since the low-level driver capability is already present.
> 
> If I get some free time I'll dig around a bit and see if I can cobble
> something up.  It's of some interest to me as well since I have a GPS
> clock here that currently talks to a serial port on an Intel-based
> machine and being able to move that to a $35 "appliance" for NTP
> using
> the Adafruit setup looks sort of attractive given that the Pi plus
> the
> module would be under $100 all-in.
> 

Don't "cobble something up" just yet... there is "a right way" to fix
this, which is a generic gpio-pps driver.  The problem is that it
requires support from the new INTRNG, and the rpi hasn't been converted
to that yet.  I'm checking around to see if someone has done the
conversion for rpi and it just hasn't been reveiwed/committed yet; if
not, I guess I'll try to do it myself.

Writing the actual gpio-pps driver will be pretty quick and easy once
we have the intrng support, I think it'll take me a couple hours.

Also, FYI, another option with PPS is to use a usb-serial adapter and
feed the PPS in on the CTS or DCD pin.  I tested that on rpi a few
months ago and it worked fine.  There's surpisingly little jitter even
when the usb bus is heavily loaded with other traffic such as disk or
network IO.

-- Ian




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1457114408.13785.150.camel>