GPS Protocol (GARMIN 40)    

[ GPS Main Page | Cable Connection | GPS-Protocol | NMEA Info ]

OBSERVATIONS OF THE GARMIN-GARMIN PROTOCOL


last update: July 4, 1996
author: william.soley@sun.com, werme@zk3.dec.com
URL: http://playground.sun.com/pub/soley/garmin.txt
(this work has nothing to do with Sun Micro-
systems) (nor Digital Equipment Corp.)

This is a description of the GARMIN-GARMIN protocol as spoken by theGarmin GPS-75
GPS receiver and the Garmin PCX5 MS-DOS software. Theinformation here has been
determined by observing the communicationbetween the two units while sending "chosen
plaintext". This spec isat best, incomplete, and at worst, incorrect. Lots of assumptionswere
made based on the observed behavior of the protocol. It is alsounknown how much of this
protocol is common to other Garmin products.But, unless Garmin decides to be cooperative,
this is about the bestwe can do. Use it at your own risk!

All references to GPS-75 behavior came from William Soley. A majorupdate to this was
made in July, 1996 by Eric Werme, studying thebehavior of his GPS-45. There is much in
common between the protocolsused by the two models, but there are differences. Much of
Werme's studyfocused on protocol commands not used by PCX5, all of which are subjectto
change, even between revisions of firmware within a model! If youmust rely on some part of
the protocol, it should be part that is usedby Garmin's PCX5 software.

Layer 1

Data is standard Async.

9600 bits per second.
8 data bits.
no parity.
1 stop bit.


Layer 2

The data stream consists of frames each having the following format:

DataLinkEscape (0x10)
RecordType (one byte) $$
Length (one byte) ** $$
DataField ("length" bytes) ** $$
CheckSum (one byte) **
DataLinkEscape (0x10)
EndTransmission (0x03)

** - fields indicated by "**" are subject to escape. Any occurrence ofa DataLinkEscape
character (0x10) in these fields is preceded byanother DataLinkEscape (0x10) resulting in a
pair. Escape bytes addedin this way are not counted in the record length (i.e. bytes are
countedbefore the escapes are added).

$$ - the bytes comprising fields indicated by "$$" are summed and thelow-order 8 bits are
then negated (2's complement) to form theCheckSum. Any added DataLinkEscapes are not
included in the sum.

Software processing this protocol layer on input can discard the initialDataLinkEscape, the
checksum and later bytes, and compress the doubleDataLinkEscapes into one. The
remaining bytes constitute Layer 3 protocolframes.

Layer 3

When a non-ACK/NAK or asynchronous frame is received an ACK or NAK is sentdepending
on the checksum validity of the received frame. ACK/NAK frames arethe same format as a
regular frame:

RecordType = 0x06 (ACK) or 0x15 (NAK)
Length = 2
DataField = RecordType of record being
acknowledged, 0x00

When a non-ACK/NAK frame is sent, the sender waits for an ACK/NAK. Ifa NAK is received,
or if no ACK is received after about 1 second, thesender retransmits the frame.


Power Up

When the GPS-75 is powered on, it transmits an 0x5A character.
When the GPS-45 is powered on, it transmits 0xFE and 0X5A characters.

Holding the button while pressing to turn the unit onwill erase the unit's
memory and result in the messages:

Stored Data Lost
Searching the Sky
Holding the button while pressing to turn the unit on will put theunit in TEST
mode. The GPS-75 a will display a series of concentricrectangles will be displayed and
animated to give the illusion of passingthrough a tunnel. Pressing will toggle
between the tunnel display and adisplay showing:

Testing ...
Sgnl Amplitude 2168
TCX0 Drift -19.978

While in TEST mode, a continuous stream of RecordType=0x00, 0x01,and 0x0d messages
will be sent to the serial port.Also, while in TEST mode the "<" and ">" may be used to
adjustdisplay contrast, but the adjustment does not appear to be saved.

The GPS-45 behaves somewhat differently. The status screen is the first tobe displayed
and includes a keypad test test feature. In addition to thebox display is an all black display.
The GPS will send a stream of RecordTypes 0x00, 0x27, 0x28.

Data Presentation

Numeric data within the Garmin protocol is in binary, and several formatsare used. Those
are described here. Skimming this section now will make iteasier to understand the
protocol's commands.

short integer
- length = 2 bytes, in order of increasing significance.
Negative numbers are expressed as 2's complement.

Examples:
00 00 = 0x0 = 0
01 00 = 0x1 = 1
10 00 = 0x10 = 16
00 01 = 0x100 = 256
00 10 = 0x1000 = 4096
ff ff = 0xffff = -1
f0 ff = 0xfff0 = -16


long integer
- length = 4 bytes, in order of increasing significance.
Negative numbers are expressed as 2's complement.

Examples:
00 00 00 00 = 0x0 = 0
01 00 00 00 = 0x1 = 1
00 01 00 00 = 0x100 = 256
00 00 01 00 = 0x10000 = 65536
00 00 00 01 = 0x1000000 = 16777216
ff ff ff ff = 0xffffffff = -1
f0 ff ff ff = 0xfffffff0 = -16

float
- length = 4 bytes, IEEE single precision floating
point. Least significant byte first.

This format consists of:
1 bit - sign
8 bits - exponent, excess 127
23 bits - mantissa, implied high-order 1

double
- length = 8 bytes, IEEE double precision floating
point. Least significant byte first.

This format consists of:
1 bit - sign
11 bits - exponent, excess 1023
52 bits - mantissa, implied high-order 1

ASCII string
- series of ASCII bytes, usually padded with blanks.

Example:
47 50 53 20 37 35 20 20 32 2e 32 31 20 = "GPS 75 2.21"

date/time
- length = 4 bytes, long unsigned integer encoded as
86400 + number of seconds since midnight, Jan 1 1990.
Note: unix_time = garmin_time + 631065600

Examples:
00 00 00 00 = 0x0 = undefined
80 51 01 00 = 0x15180 = Jan 1 1990 00:00:00
7d f0 ef 2d = 0x2deff07d = Jun 4 1994 03:09:49


long lat/lon
- length = 4 bytes, long signed integer encoded as
11930464.7111111111 * lat/lon in degrees, or
683565275.576431632 * lat/lon in radians.
The former factor as a ratio is 2**30/90.
As a C expression, it is ((1L << 30) / 90.0).
All values are in map datum WGS 84.

Examples:
00 00 00 00 = 0x0 = 0.0 deg
61 0b b6 00 = 0xb60b61 = 1.0 deg
00 00 00 40 = 0x40000000 = 90.0 deg
00 00 00 c0 = 0xc0000000 = -90.0 deg
00 00 00 80 = 0x80000000 = -180.0 deg

double lat/lon
- length = 8 bytes, IEEE double precision floating point
encoded as lat/lon in radians. All values are in map
datum WGS 84.

Examples:
00 00 00 00 00 00 00 00 = 0.0 rad
00 00 00 00 00 00 f0 3f = 1.0 rad
00 00 00 00 00 00 f8 3f = 1.5 rad
00 00 00 00 00 00 00 40 = 2.0 rad
00 00 00 00 00 00 08 40 = 3.0 rad
00 00 00 00 00 00 f0 bf = -1.0 rad
00 00 00 00 00 00 00 c0 = -2.0 rad


[ GPS Main Page | Cable Connection | GPS-Protocol | NMEA Info ]