[LinuxPPS] PPS via FTDI 232 doesn't work, many questions

Ben Adler adler at informatik.uni-hamburg.de
Thu Nov 17 20:48:36 CET 2011


Hello list!

I'm trying to get Linux PPS working on an embedded system running ubuntu 
10.10 with linux 2.6.35. Although I'd love to use a real UART, parallel 
port or GPIO pin, the board only features USB ports and two serial ports 
behind an FTDI 232RL USB<->RS232 converter.

Instead of the GPS device, for now a function generator is connected to 
the DCD line of /dev/ttyUSB1, and its signal goes from high (5V) to low 
(0V) every second, staying low for about 100msec.

On the same port, RX and TX are shorted, so when I open minicom and hold 
down a key, I see it printed repeatedly, with the online-indicator in 
the lower-right corner jumping from OFFLINE to ONLINE and back every 
second for 100msec - but only as long as I hold down any key.

For low latency on the usb-serial-port, I check
$ cat /sys/bus/usb-serial/devices/ttyUSB1/latency_timer
1

I thought 16ms was the default, but this value is always 1 on my system. 
Even if I write e.g. 16 into it, it stays 1. The value is the amount of 
milliseconds that bytes are allowed to stay in FTDI232's buffer before 
being passed on to the host.

# modprobe pps_core
dmesg says:
[  223.190630] LinuxPPS API ver. 1 registered
[  223.190639] Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo 
Giometti <giometti at linux.it>

# ldattach -d PPS /dev/ttyUSB1
ldattach:opened /dev/ttyUSB1
ldattach:set to raw 0 ---: cflag=0xcbd
ldattach:line discipline set to 18

dmesg says:
[  277.853871] PPS line discipline registered
[  277.854707] new PPS source usbserial1 at ID 0
[  277.854762] PPS source #0 "/dev/ttyUSB1" added

# ls -l /dev/pps*
crw------- 1 root root 250, 0 2011-11-17 17:54 /dev/pps0

# setserial /dev/ttyUSB1 hardpps
# setserial /dev/ttyUSB1
/dev/ttyUSB1, UART: unknown, Port: 0x0000, IRQ: 0, Flags: hardpps 
low_latency

# ./ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
...

And this is my problem, the last line is repeated forever.
# cat /sys/class/pps/pps0/assert always contains:

     0.000000000#0

and nothing ever happens. So, my questions are:

  - Why isn't this working?

  - Is it possible to use /dev/ttyUSB1 for other communications while 
its CD line is used for PPS? Can I simply use the port as if it weren't 
used already? I gather that people usually use RX and TX for NMEA to 
sync the non-second parts of time, but my clock is already precise to 
about 20ms and I want to use PPS for even better precision.

  - What's the precision/lag I can expect when using a usb to serial 
converter? Are there any experiences?

  - Is xPPS supported, i.e. can I tell my GPS device to output PPS e.g. 
every 2,5 or 10 seconds and it'll also work?

  - Should the PPS signal be high and dip low on every full second, or 
the other way around?

  - How long should that pulse be? Is the answer a function of the 
port's baudrate? Can the pulse be too long?

  - Is the "kernel consumer" the same as "hardpps"? From what I 
understand, hardpps directly adjusts the clock in kernel-space, whereas 
using /sys/class/pps/pps0/{assert,clear} means that I'd need a running 
ntp-server to interpret these files and work the clock. Is that right?

  - Is the latency_timer value above also relevant for state changes on 
CD or just for data bytes?

  - Is it possible for hardpps to change the status of another line X on 
the serial port after it has received a PPS signal on the CD line? I'd 
like to use this to measure the time from PPS clock on CD line to the 
status change on line X using an oscilloscope. I hope this would allow 
me to approximate a latency between the real PPS and the time hardpps 
thinks it is.

These are my questions after reading about LinuxPPS for a day - I hope 
that you can enlighten me on at least a few of them. Thanks for reading 
to the end!

Ben Adler



More information about the LinuxPPS mailing list