= Hewlett Packard GPS Receivers -  HP 58503A and HP Z3801A
include::include-html.ad[]

== Synopsis

["verse",subs="normal"]
Name: hpgps
Reference ID: GPS
Driver ID: GPS_HP
Serial Port: /dev/hpgps__u__; 9600 bps 8N1, 19200 bps 7N2 for the HP Z3801A

== Warning

Old gear, like the Z3801A has GPS WNRO problems (see
link:rollover.html[Rollover issues in time sources]).
The driver should adjust the time forward by N*1024 weeks
to get a sane time.

== Description

This driver supports the HP 58503A Time and Frequency Reference Receiver
and HP Z3801A GPS Receiver. It will probably work with other Z38xx models.
Two-unit pairs of these are sometimes known as a KS-24361. All of
these product are well past end-of-life.

These receivers are very old designs, dating from around 1990, so
their GPS receiver stages are not very sensitive by modern
standards. On the other hand, lots of them are available cheap,
because they used to be standard kit on cell towers and were surplussed
off in the thousands.

They use HP SmartClock (TM) to implement an Enhanced GPS receiver. The
receiver accuracy when locked to GPS in normal operation is better
than 1 µs. The accuracy when operating in holdover is typically
better than 10 µs per day.

The driver expects the receiver to be running in UTC mode
and T2 mode.  You can set that up using:

-------------------------------------
  :ptime:tcode:format F2
  :diag:gps:utc 1
-------------------------------------

The latter isn't documented and needs a reboot to take effect.

The driver uses the poll sequence +:PTIME:TCODE?+ to get a response from
the receiver. The receiver responds with a timecode string of ASCII
printing characters, followed by a <cr><lf>, followed by a prompt string
issued by the receiver, in the following format:

-------------------------------------
T#yyyymmddhhmmssMFLRVcc<cr><lf>scpi >
-------------------------------------

The driver processes the response at the <cr> and <lf>, so what the
driver sees is the prompt from the previous poll, followed by this
timecode. The prompt from the current poll is (usually) left unread
until the next poll. So (except on the very first poll) the driver sees
this:

-------------------------------------
scpi >T#yyyymmddhhmmssMFLRVcc<cr><lf>
-------------------------------------

The T is the on-time character, at 980 ms before the next 1PPS edge.
The # is the timecode format type. We look for format 2. Without any of
the CLK or PPS stuff, then, the receiver buffer timestamp at the <cr> is
24 characters later, which is about 25 ms. at 9600 bps, so the first
approximation for the +time1+ option is nominally -0.955 s. This number
probably needs adjusting for each machine / OS type, so far: -0.955000 s
on an HP 9000 Model 712/80 HP-UX 9.05 -0.953175 s on an HP 9000 Model 370
HP-UX 9.10

This driver will probably work with the 58503B and 59551A if they are
set up appropriately.

To use an HP Z3801A, specify +subtype 1+ on the server config line to setup
the right line parameters.

The timekeeping portion of HP's business was sold to Symmetricom; Symmetricom
was later acquired by https://www.microsemi.com/[Microsemi].

== Rollover compensation

Some devices in this product line have a front-panel display of
date-time and controls to manipulate it.  On these, it is possible to
reset the device's hidden base date for your current era. Consult
your documentation for details.

== Driver Options

+unit+ 'number'::
  The driver unit number, defaulting to 0. Used as a distinguishing
  suffix in the driver device name.
+time1+ 'time'::
   Specifies the time offset calibration factor, in seconds and fraction,
   with default 0.0.
+time2+ 'time'::
   Not used by this driver.
+stratum+ 'number'::
   Specifies the driver stratum, in decimal from 0 to 15, with default 0.
+refid+ 'string'::
   Specifies the driver reference identifier, an ASCII string from one to
   four characters, with default +GPS+.
+flag1 {0 | 1}+::
   Not used by this driver.
+flag2 {0 | 1}+::
   Listen only mode, for use with a line splitter so 2 clients
   can listen to the same device.  Unlike many GPS devices, the
   HP devices do not have a mode that automatically sends the
   time each second.  The driver has to ask each time.  This
   mode assumes another dirver is doing the asking and ignores
   everything but T2 replies so it won't get confused if that
   other driver is using flag3 or flag4.
+flag3 {0 | 1}+::
   Adds extra stats to the clockstats line
+flag4 {0 | 1}+::
   Adds a status page to clockstats.
+subtype+::
   Setting mode 1 configures for the HP Z3801A.
+mode+::
  Synonym for subtype, retained for backward compatibility.
+path+ 'filename'::
  Overrides the default device path.
+ppspath+ 'filename'::
  Not used by this driver.
+baud+ 'number'::
  Overrides the default baud rate.

== Monitor Data   

The last T2 sentence that is accepted or rejected is written to the
clockstats file and available with +ntpq -c clockvar+. If +flag3+ is set,
several more internal variables are logged.

----------------------------------------------------------------------------
60908 28302.174 HPGPS(0) T220060105075143300003B  64 0  +3 +1.07000E+002 0 +1.5E-006 0 +660669 +2.60128E+001
----------------------------------------------------------------------------

.Clockstats
[cols="10%,20%,70%",options="header"]
|=============================================================================
|Column|Sample          |Meaning
|1     |60908           |MJD
|2     |28302.174       |Time of day in seconds
|3     |HPGPS(0)        |Driver type and unit.
|4     |T2...           |T2 sentence from unit
|5     |64              |Number of sentences accepted and used for timekeeping
|6     |0               |Number of sentences rejected
|||Below only if flag3 is on
|7     |+3              | result from :GPS:SAT:TRAC:COUNT?
|8     |+1.07000E+002   | result from :ROSC:HOLD:DUR? (duration of this or last holdover)
|9     |0               | 1 if in holdover
|10    |+1.5E-006       | result from :ROSC:HOLD:TUNC:PRED?
|11    |0               | ???
|12    |+660669         | result from DIAG:ROSC:EFC:ABS? (DAC value)
|13    |+2.60128E+001   | result from :DIAG:ROSC:EFC:REL? (-100 to 100)
|=============================================================================



== Configuration Example

----------------------------------------------------------------------------
refclock hpgps
----------------------------------------------------------------------------

'''''

include::includes/footer.adoc[]
