Historic archive of defunct list thumbgps-devel@lists.bufferbloat.net
 help / color / mirror / Atom feed
* [Thumbgps-devel] PPS over USB Serial can work
@ 2012-03-17  3:17 Andrew McGregor
  2012-03-17  6:45 ` Eric S. Raymond
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew McGregor @ 2012-03-17  3:17 UTC (permalink / raw)
  To: thumbgps-devel


[-- Attachment #1.1: Type: text/plain, Size: 4475 bytes --]

I decided to try a practical experiment, to prove one way or another if USB serial PPS on a consumer router can work, and how well.

Short summary: it works, jitter is at the 300 µs level.


Ingredients:

Garmin GPS 18x LVC.  I used this simply because I had a local supplier, and it comes in a waterproof enclosure in case I had to put the antenna outside.  Turns out I don't need to do that.

Sparkfun FL232RL breakout board. http://www.sparkfun.com/products/718

A WNDR3700v2, which I am also using as my edge router at home, running openwrt trunk from a couple of weeks ago.

ntpd and gpsd


Method:

Most of what I did here followed the instructions at http://www.rjsystems.nl/en/2100-ntpd-garmin-gps-18-lvc-gpsd.php

So, I wired the breakout for 5V serial levels, and wired the GPS to the serial side using the pinout above.

It turns out that the GPS 18x LVC uses RS232 (inverted) polarity for its data signals, and the FT232RL defaults to TTL polarity for data lines, so I had to download FTDI's FT_PROG reprogrammer (for Windows, sadly) and reverse the serial line polarity.  This got the NMEA going.  Note that the FT232RL also defaults to inverted polarity on the flow control lines, so I eventually had to change those back to default to get PPS working.  FT_PROG can also set the USB product and vendor IDs, and for a production device the command line version would be used during manufacturing to set all this up appropriately.

The GPS 18x outputs its NMEA sentences after the matching PPS, and centered between pulses.  They're variable length, so the NMEA jitter is considerable.  I've configured my NTP with a noselect on the NMEA, so that I can see what it is doing but it will not contribute to the clock.  gpsd will still use the NMEA to disambiguate the PPS signal.

I set the GPS for factory standard sentence output, at 19200 baud, and a PPS pulse width of 150 ms using

$PGRMO,,4
$PGRMC,,,,,,,,,,5,,2,6,

(note that you have to send those sentences using CRLF line endings).

I found that this GPS has excellent reception, simply placing it on floor just inside a full-height window gets a solid lock on at least six satellites, often as many as nine, with only a little sky view and most of that obscured by foliage (it helps that the house has a cement tile roof and wooden frame, I'm sure).

After a long evening of experimentation and finding suitable fudge factors, I ended up with this ntp.conf:

restrict default nomodify notrap

restrict 127.0.0.1
restrict 192.168.1.0 mask 255.255.255.0
restrict fe80:: mask ffc0::

driftfile  /etc/ntp.drift

pool openwrt.pool.ntp.org iburst
pool nz.pool.ntp.org iburst
server ntp.snap.net.nz iburst
server 2.us.pool.ntp.org iburst

enable calibrate

# GPSD NMEA+PPS
server 127.127.28.0 minpoll 4 noselect
fudge  127.127.28.0 stratum 1 time1 0.5437 time2 410 refid NMEA
server 127.127.28.1 minpoll 4 prefer true
fudge  127.127.28.1 stratum 1 flag3 1 time2 0.600 refid PPS

And these flags for gpsd:

gpsd -b -G -n -P /var/run/gpsd.pid -S 2947


Proof of the pudding:

$ ntpq -np 192.168.1.1
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-202.89.49.65    203.109.135.194  3 u   61   64  377   22.885   -0.678  15.869
+203.97.109.165  .PPSa.           1 u   54   64  377   18.069   -0.606   2.431
+203.99.128.34   131.203.16.6     2 u   55   64  377   12.114    0.428   0.383
-202.37.101.1    91.189.94.4      3 u   57   64  377    4.255    0.797   0.446
-2001:4f8:fff7:1 69.25.96.13      2 u   48   64  377  158.527    2.141   0.128
 127.127.28.0    .NMEA.           1 l   14   16  377    0.000  -20.338  12.376
*127.127.28.1    .PPS.            1 l   13   16  377    0.000   -0.120   0.256

I have not adjusted in any offset for USB latency in the PPS signal, as I don't know what a suitable value would be.  Although looking at that data, 500 µs may be about right.

However, the real point here is the jitter; it varies a bit, but is almost always under 300 µs.

It also seems that the WNDR3700 has a reasonable clock, the drift value converged to 6.789 PPM.

I've attached a couple of photos of the breakout.  The red wire on the top side jumpers the board for 5V IO, I'm not sure it is necessary given the solder jumper just above it on the left side.


Cheers all, project is feasible :-)

Andrew



[-- Attachment #1.2.1: Type: text/html, Size: 6484 bytes --]

[-- Attachment #1.2.2: IMG_0489.jpeg --]
[-- Type: image/jpg, Size: 106494 bytes --]

[-- Attachment #1.2.3: IMG_0490.jpeg --]
[-- Type: image/jpg, Size: 71320 bytes --]

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2330 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Thumbgps-devel] PPS over USB Serial can work
  2012-03-17  3:17 [Thumbgps-devel] PPS over USB Serial can work Andrew McGregor
@ 2012-03-17  6:45 ` Eric S. Raymond
  2012-03-17  9:53   ` Andrew McGregor
  0 siblings, 1 reply; 13+ messages in thread
From: Eric S. Raymond @ 2012-03-17  6:45 UTC (permalink / raw)
  To: Andrew McGregor; +Cc: thumbgps-devel

Andrew McGregor <andrewmcgr@gmail.com>:
> I decided to try a practical experiment, to prove one way or another if USB 
> serial PPS on a consumer router can work, and how well.
> 
> Short summary: it works, jitter is at the 300 µs level.

Excellent!

Any chance you can run a similar test with a PL2303?  The FTDI SIO is only 
the second-most-likely converter to wind up in our device.  I see PL2303
breakout boards are available for < $10 on eBay, though you might have to work
a bit to find one that has pins for the handshake lines on the input side.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Thumbgps-devel] PPS over USB Serial can work
  2012-03-17  6:45 ` Eric S. Raymond
@ 2012-03-17  9:53   ` Andrew McGregor
  2012-03-17 10:11     ` Eric S. Raymond
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew McGregor @ 2012-03-17  9:53 UTC (permalink / raw)
  To: esr; +Cc: thumbgps-devel

[-- Attachment #1: Type: text/plain, Size: 791 bytes --]

I probably can, but it might be three weeks or so given my schedule.

Andrew

On 17/03/2012, at 7:45 PM, Eric S. Raymond wrote:

> Andrew McGregor <andrewmcgr@gmail.com>:
>> I decided to try a practical experiment, to prove one way or another if USB 
>> serial PPS on a consumer router can work, and how well.
>> 
>> Short summary: it works, jitter is at the 300 µs level.
> 
> Excellent!
> 
> Any chance you can run a similar test with a PL2303?  The FTDI SIO is only 
> the second-most-likely converter to wind up in our device.  I see PL2303
> breakout boards are available for < $10 on eBay, though you might have to work
> a bit to find one that has pins for the handshake lines on the input side.
> -- 
> 		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2330 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Thumbgps-devel] PPS over USB Serial can work
  2012-03-17  9:53   ` Andrew McGregor
@ 2012-03-17 10:11     ` Eric S. Raymond
  2012-03-17 11:38       ` Andrew McGregor
  2012-03-17 17:42       ` Dave Taht
  0 siblings, 2 replies; 13+ messages in thread
From: Eric S. Raymond @ 2012-03-17 10:11 UTC (permalink / raw)
  To: Andrew McGregor; +Cc: thumbgps-devel

Andrew McGregor <andrewmcgr@gmail.com>:
> I probably can, but it might be three weeks or so given my schedule.

Please do.  

I've been watching the market for USB GPS mice since 2005.  The PL2303
is about 80% likely to be the adapter in one of these chosen at random
(allowing for sales volume of GPS types).  The FTDI SIO you tested is
the next most common type.  After that, in really small percentages,
you get the Cypress M8/CY7C64013 and the Cygnal Integrated Products,
Inc. CP210x.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Thumbgps-devel] PPS over USB Serial can work
  2012-03-17 10:11     ` Eric S. Raymond
@ 2012-03-17 11:38       ` Andrew McGregor
  2012-03-17 17:42       ` Dave Taht
  1 sibling, 0 replies; 13+ messages in thread
From: Andrew McGregor @ 2012-03-17 11:38 UTC (permalink / raw)
  To: esr; +Cc: thumbgps-devel

[-- Attachment #1: Type: text/plain, Size: 850 bytes --]

Randomly, I just found a USB-Serial cable I thought I'd lost, and it turns out to be a PL2303.  So all I need is some connectors, and I can test that.  Might still be three weeks, since I'm travelling.

On 17/03/2012, at 11:11 PM, Eric S. Raymond wrote:

> Andrew McGregor <andrewmcgr@gmail.com>:
>> I probably can, but it might be three weeks or so given my schedule.
> 
> Please do.  
> 
> I've been watching the market for USB GPS mice since 2005.  The PL2303
> is about 80% likely to be the adapter in one of these chosen at random
> (allowing for sales volume of GPS types).  The FTDI SIO you tested is
> the next most common type.  After that, in really small percentages,
> you get the Cypress M8/CY7C64013 and the Cygnal Integrated Products,
> Inc. CP210x.
> -- 
> 		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2330 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Thumbgps-devel] PPS over USB Serial can work
  2012-03-17 10:11     ` Eric S. Raymond
  2012-03-17 11:38       ` Andrew McGregor
@ 2012-03-17 17:42       ` Dave Taht
  2012-03-17 18:04         ` Eric S. Raymond
  1 sibling, 1 reply; 13+ messages in thread
From: Dave Taht @ 2012-03-17 17:42 UTC (permalink / raw)
  To: esr; +Cc: thumbgps-devel

On Sat, Mar 17, 2012 at 3:11 AM, Eric S. Raymond <esr@thyrsus.com> wrote:
> Andrew McGregor <andrewmcgr@gmail.com>:
>> I probably can, but it might be three weeks or so given my schedule.
>
> Please do.
>

Was not the miracle of 300 us on the FTDI enough? :)

> I've been watching the market for USB GPS mice since 2005.  The PL2303
> is about 80% likely to be the adapter in one of these chosen at random
> (allowing for sales volume of GPS types).  The FTDI SIO you tested is
> the next most common type.  After that, in really small percentages,
> you get the Cypress M8/CY7C64013 and the Cygnal Integrated Products,
> Inc. CP210x.
> --
>                <a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
> _______________________________________________
> Thumbgps-devel mailing list
> Thumbgps-devel@lists.bufferbloat.net
> https://lists.bufferbloat.net/listinfo/thumbgps-devel



-- 
Dave Täht
SKYPE: davetaht
US Tel: 1-239-829-5608
http://www.bufferbloat.net

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Thumbgps-devel] PPS over USB Serial can work
  2012-03-17 17:42       ` Dave Taht
@ 2012-03-17 18:04         ` Eric S. Raymond
  2012-03-17 21:49           ` tz
  2012-03-20 11:35           ` Andrew McGregor
  0 siblings, 2 replies; 13+ messages in thread
From: Eric S. Raymond @ 2012-03-17 18:04 UTC (permalink / raw)
  To: Dave Taht; +Cc: thumbgps-devel

Dave Taht <dave.taht@gmail.com>:
> On Sat, Mar 17, 2012 at 3:11 AM, Eric S. Raymond <esr@thyrsus.com> wrote:
> > Andrew McGregor <andrewmcgr@gmail.com>:
> >> I probably can, but it might be three weeks or so given my schedule.
> >
> > Please do.
> 
> Was not the miracle of 300 us on the FTDI enough? :)

No.  Now that we know what he's good at, we'll exploit him ruthlessly. :-)

/me notes that he needs to write a blog entry about holding up the sky.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Thumbgps-devel] PPS over USB Serial can work
  2012-03-17 18:04         ` Eric S. Raymond
@ 2012-03-17 21:49           ` tz
  2012-03-18  1:34             ` Eric S. Raymond
  2012-03-20 11:35           ` Andrew McGregor
  1 sibling, 1 reply; 13+ messages in thread
From: tz @ 2012-03-17 21:49 UTC (permalink / raw)
  To: esr; +Cc: thumbgps-devel

[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]

Note the atmel usb-to-serial chips used on the arduino are opensource and
reprogrammable.  There is a breakout from sparkfun which I should test -
the icp pin is broken out and should provide a minimum delay path.  You
should add it to the consideration list
 On Mar 17, 2012 2:04 PM, "Eric S. Raymond" <esr@thyrsus.com> wrote:

> Dave Taht <dave.taht@gmail.com>:
> > On Sat, Mar 17, 2012 at 3:11 AM, Eric S. Raymond <esr@thyrsus.com>
> wrote:
> > > Andrew McGregor <andrewmcgr@gmail.com>:
> > >> I probably can, but it might be three weeks or so given my schedule.
> > >
> > > Please do.
> >
> > Was not the miracle of 300 us on the FTDI enough? :)
>
> No.  Now that we know what he's good at, we'll exploit him ruthlessly. :-)
>
> /me notes that he needs to write a blog entry about holding up the sky.
> --
>                <a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
> _______________________________________________
> Thumbgps-devel mailing list
> Thumbgps-devel@lists.bufferbloat.net
> https://lists.bufferbloat.net/listinfo/thumbgps-devel
>

[-- Attachment #2: Type: text/html, Size: 1754 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Thumbgps-devel] PPS over USB Serial can work
  2012-03-17 21:49           ` tz
@ 2012-03-18  1:34             ` Eric S. Raymond
  0 siblings, 0 replies; 13+ messages in thread
From: Eric S. Raymond @ 2012-03-18  1:34 UTC (permalink / raw)
  To: tz; +Cc: thumbgps-devel

tz <tz2026@gmail.com>:
> Note the atmel usb-to-serial chips used on the arduino are opensource and
> reprogrammable.  There is a breakout from sparkfun which I should test -
> the icp pin is broken out and should provide a minimum delay path.  You
> should add it to the consideration list

Name it and it's yours.  The vanilla USB dongle with GPS +
USB-to-serial that I'm pursuing is "Plain Jane"; if you want yours to
compete, sketch a full design and name iy so we can all know what
we're talking about.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Thumbgps-devel] PPS over USB Serial can work
  2012-03-17 18:04         ` Eric S. Raymond
  2012-03-17 21:49           ` tz
@ 2012-03-20 11:35           ` Andrew McGregor
  2012-03-20 12:06             ` Eric S. Raymond
  1 sibling, 1 reply; 13+ messages in thread
From: Andrew McGregor @ 2012-03-20 11:35 UTC (permalink / raw)
  To: esr; +Cc: thumbgps-devel

[-- Attachment #1: Type: text/plain, Size: 993 bytes --]

Ok, make that three days.

Having hooked up a PL2303-based USB serial cable, I conclude that it works, and without a long-term test I can't see any particular difference to the FTDI board.  It's just possible that the jitter may be slightly higher, but I have no logging with which to collect statistics at the moment.  That will be more than I can get done before I go away.

Andrew

On 18/03/2012, at 7:04 AM, Eric S. Raymond wrote:

> Dave Taht <dave.taht@gmail.com>:
>> On Sat, Mar 17, 2012 at 3:11 AM, Eric S. Raymond <esr@thyrsus.com> wrote:
>>> Andrew McGregor <andrewmcgr@gmail.com>:
>>>> I probably can, but it might be three weeks or so given my schedule.
>>> 
>>> Please do.
>> 
>> Was not the miracle of 300 us on the FTDI enough? :)
> 
> No.  Now that we know what he's good at, we'll exploit him ruthlessly. :-)
> 
> /me notes that he needs to write a blog entry about holding up the sky.
> -- 
> 		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2330 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Thumbgps-devel] PPS over USB Serial can work
  2012-03-20 11:35           ` Andrew McGregor
@ 2012-03-20 12:06             ` Eric S. Raymond
  2012-03-20 14:41               ` tz
  0 siblings, 1 reply; 13+ messages in thread
From: Eric S. Raymond @ 2012-03-20 12:06 UTC (permalink / raw)
  To: Andrew McGregor; +Cc: thumbgps-devel

Andrew McGregor <andrewmcgr@gmail.com>:
> Ok, make that three days.
> 
> Having hooked up a PL2303-based USB serial cable, I conclude that it works, and without a long-term test I can't see any particular difference to the FTDI board.  It's just possible that the jitter may be slightly higher, but I have no logging with which to collect statistics at the moment.  That will be more than I can get done before I go away.

Thanks.  Knowing it's in the same general sub-1ms range is enough to
advance the ball on Plain Jane.  Detailed stats may be interesting
later but there is no time pressure about that.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Thumbgps-devel] PPS over USB Serial can work
  2012-03-20 12:06             ` Eric S. Raymond
@ 2012-03-20 14:41               ` tz
  2012-03-20 21:31                 ` Eric S. Raymond
  0 siblings, 1 reply; 13+ messages in thread
From: tz @ 2012-03-20 14:41 UTC (permalink / raw)
  To: esr; +Cc: thumbgps-devel

http://www.sparkfun.com/products/10277

It doesn't support CTS/DCD/RI "out of the box", but the source is
there.  We can name it what we want (there is the vendor/product ID
problem - we should be able to get one, but the text string can be
uniquely ours).

The base code (at github) has a delay to buffer characters with a
timeout, but that can be eliminated or short circuited for the "$"
which begins NMEA sentences.

I haven't seen all the LUFA library, but going from the ICP interrupt
to sending a DCD shouldn't be that hard.

more here - I haven't found DCD support yet but it shouldn't be hard to add.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Thumbgps-devel] PPS over USB Serial can work
  2012-03-20 14:41               ` tz
@ 2012-03-20 21:31                 ` Eric S. Raymond
  0 siblings, 0 replies; 13+ messages in thread
From: Eric S. Raymond @ 2012-03-20 21:31 UTC (permalink / raw)
  To: tz; +Cc: thumbgps-devel

tz <thomas@mich.com>:
> http://www.sparkfun.com/products/10277
> 
> It doesn't support CTS/DCD/RI "out of the box", but the source is
> there.  We can name it what we want (there is the vendor/product ID
> problem - we should be able to get one, but the text string can be
> uniquely ours).
> 
> The base code (at github) has a delay to buffer characters with a
> timeout, but that can be eliminated or short circuited for the "$"
> which begins NMEA sentences.
> 
> I haven't seen all the LUFA library, but going from the ICP interrupt
> to sending a DCD shouldn't be that hard.
> 
> more here - I haven't found DCD support yet but it shouldn't be hard to add.

That is interesting, if only because we can get at the firmware. Worth
keeping in mind - it now looks like "Plain Jane" will work, but if it doesn't...
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-03-20 21:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-17  3:17 [Thumbgps-devel] PPS over USB Serial can work Andrew McGregor
2012-03-17  6:45 ` Eric S. Raymond
2012-03-17  9:53   ` Andrew McGregor
2012-03-17 10:11     ` Eric S. Raymond
2012-03-17 11:38       ` Andrew McGregor
2012-03-17 17:42       ` Dave Taht
2012-03-17 18:04         ` Eric S. Raymond
2012-03-17 21:49           ` tz
2012-03-18  1:34             ` Eric S. Raymond
2012-03-20 11:35           ` Andrew McGregor
2012-03-20 12:06             ` Eric S. Raymond
2012-03-20 14:41               ` tz
2012-03-20 21:31                 ` Eric S. Raymond

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox