Table of Contents

NAVILINK Protocol

This page is based on the Navilink protocol specification of Jun 30, 2005 provided by Locosys as PDF. Things found to be different in the real protocol implementation have been fixed in the specification below.

1. General Description

This document describes the NAVILINK Interface, which is used to communicate with a NAViGPS device. The NAVILINK Interface supports bi-directional transfer of data such as waypoints, routes, track data.

2. Physical Layer

The physical protocol is based on USB. The electrical characteristics are full duplex, serial data, 115200 baud, 8 data bits, no parity bits and 1 stop bit.

3. Packet Specification

Packet Format

The general packet of NAVILINK protocol is defined as follows:

Start Sequence Packet Length Payload Packet Checksum End Sequence
0xA0, 0xA2 Two-bytes (15-bits) Up to 215-1 Two-bytes (15-bits) 0xB0, 0xB3

Bytes in a packet are transmitted low order byte first, followed by the high byte (little-endian order).

4. Packet Summary

Below all packet types of the NaviLink protocol are described. For each type the sending direction is given (H→D, H←D or H↔D), where H is the Host computer and D the NAViGPS device.

For communicating with the device, the NAVILINK Mode needs to be enabled. In NAViGPS side, you can select function NAVILINK to set NAViGPS in link mode. You may exit from link mode by pressing any key or send a PID_QUIT packet to it. The NAViGPS will be reset after exiting from link mode.

Beginning and Ending Packets For a host to connecting to NAViGPS, the beginning packet PID_SYNC must be sent to establish the connection. Packet PID_ACK is received if the connection is OK. After the connection is established, the other packets then can be sent. Usually PID_QRY_CONFIG is sent to get the device configuration. Send packet PID_QUIT to end the connection.

Uploading Routes To upload a route, the waypoints referred in the route should be uploaded first. You may first back up all waypoints and routes then download new waypoints and new routes to guarantee data consistency.

PID_SYNC

The beginning packet to check if NAVi GPS device is ready or not.

Expect to receive PID_ACK if NAViGPS is ready. The result can be failed if NAViGPS is not in link mode or USB connection is not ready.

PID_ACK

General acknowledge packet

PID_NAK

General none-acknowledge packet

PID_QRY_INFORMATION

Packet to query NAViGPS information

Expect to receive a PID_DATA packet with payload data in T_INFORMATION type

PID_QRY_FW_VERSION

Packet to query the firmware version of the device

The device will return a PID_DATA packet holding the firmware version as a string.

PID_DATA

General data packet.

PID_ADD_A_WAYPOINT

Packet to add a route to NAViGPS

Expect to receive a PID_DATA packet with assigned waypoint ID if successful else PID_NAK is received

PID_QRY_WAYPOINTS

Packet to read 1 to 32 waypoints from NAVIGPS

Expect to receive PID_DATA packet with payload in T_WAYPOINTS, receive PID_NAK if no waypoints read.

For example, to read the first waypoint by sending: [A0 A2 08 00 28 00 00 00 00 01 00 01 2A 00 B0 B3]

To read the second and third waypoints by sending: [A0 A2 08 00 28 01 00 00 00 02 00 01 2C 00 B0 B3]

PID_QRY_ROUTE

Packet to query a route from NAViGPS

Expect to receive PID_DATA with payload in T_ROUTE type

For example, to query the first route by sending: [A0 A2 08 00 24 00 00 00 00 00 00 01 25 00 B0 B3]

PID_DEL_WAYPOINT

Packet to delete one waypoint

Expect to receive PID_ACK if successful, else PID_NAK is received. The waypoint used by any routes cannot be deleted.

For example, to delete a waypoint with ID 01 by sending: [A0 A2 05 00 36 00 00 01 00 37 00 B0 B3]

PID_DEL_ALL_WAYPOINT

Packet request deleting all waypoints

Expect to receive PID_ACK if successful else PID_NAK is received. You have to delete all routes before deleting all waypoints.

For example, to delete all routes by sending: [A0 A2 05 00 37 00 00 f0 00 27 01 B0 B3]

PID_DEL_ROUTE

Packet to delete one route

Expect to receive PID_ACK if successful, else PID_NAK is received.

For example, to delete a route with ID 01 by sending: [A0 A2 05 00 34 00 00 01 00 35 00 B0 B3]

PID_DEL_ALL_ROUTE

Packet request deleting all routes

Expect to receive PID_ACK if successful else PID_NAK is received.

For example, to delete all routes by sending [A0 A2 05 00 35 00 00 f0 00 25 01 B0 B3]

PID_ADD_A_ROUTE

Packet to add a route to NAViGPS

Expect to receive PID_DATA with assigned route ID if successful else PID_NAK is received

PID_ERASE_TRACK

Packet request deleting track

Expect PID_CMD_OK in 3 seconds if successful.

Example: [A0 A2 08 00 11 00 00 0e 40 00 00 00 5F 00 B0 B3]

PID_READ_TRACKPOINTS

Packet request reading track logs from NAViGPS

Expect to receive PID_DATA with request track data in T_TRACKPOINT type in 4 seconds if successful. Send PID_ACK if data are received correctly.

For example, to read a track of 2561) points, 2 packets of PID_READ_TRACKPOINTS are needed. The start address and byte length are as follows:

Start address Length
(0x400e0000+0) 32*256
(0x400e0000+32*256) 32*(256-2)

PID_WRITE_TRACKPOINTS

Packet request to write track points to NAVI

After sending PID_WRITE_TRACKPOINTS packet, wait a short while (about 10ms seems to be enough) then send a PID_DATA packet with trackpoint data. Then you can expect to receive PID_CMD_OK within 4 seconds if successful. The maximum track points in one PID_DATA packet is 127. For example, to write a track of 520 points, 5 packets of PID_WRITE_TRACKPOINTS are needed.

PID_CMD_OK

Packet to indicate command is OK

PID_CMD_FAIL

Packet to indicate command failed

PID_QUIT

Packet to end connection.

5. Data Type Definition

System Information

typedef struct {
    unsigned short totalWaypoint;        /* 0..1000 */
    unsigned char totalRoute;            /*0..20 */
    unsigned char totalTrack;            /* always 1 for NAViGPS */
    unsigned int startAdrOfTrackBuffer;
    unsigned int deviceSerialNum;
    unsigned short numOfTrackpoints;     /* 0..8191*/
    unsigned short protovolVersion;
    char unknown[16]; /* 16 bytes with unknown info */
    char username[16]; /* zero byte terminated */
} T_INFORMATION

Position

typedef struct {
    int latitude;             /*+-900000000,in 1/10000000 degree */
    int longitude;            /*+-1800000000,in 1/10000000 degree*/
    unsigned short altitude;  /*0..65535,in feet*/
} T_POSITION;

Size: 10 Bytes

Date & Time

typedef struct {
    unsigned char year;    /* actual year= year+2000 */
    unsigned char month;   /* 1..12 */
    unsigned char day;     /* 1..31 */
    unsigned char hour;    /* 0..23 */
    unsigned char minute;  /* 0..59 */
    unsigned char second;  /* 0..59 */
} T_DATETIME;

Size: 6 Bytes

Waypoint

typedef {
    unsigned short recordType; /* reserved. default 0x00 0x40*/
    unsigned short waypointID; /* 0..999*/
    char waypointName[7];      /* null-terminated- string,[ 0 .. 9 , , A .. Z ]*/
    unsigned char reserved;
    T_POSITION position;       /*position based on WGS84 datum*/
    T_DATETIME datetime;       /*time, date in UTC */
    unsigned char symbolType;  /*0..31*/
    unsigned char reserved;
    unsigned char tag1;        /*reserved, default 0x00 */
    unsigned char tag2;        /*reserved, default 0x7e */
} T_WAYPOINT

Size: 32 Bytes

Subroute

typedef {
    unsigned short recordType;     /*reserved, default 0x2010 */
    unsigned short waypointID[14]; /*0..999,0xffff:NULL waypoint ID */
    unsigned char tag1;            /*0x7f for last subroute*/
    unsigned char tag2;            /*reserved , default 0x77*/
} T_SUBROUTE

Route

typedef struct {
    unsigned short recordType; /*reserved, default 0x2000*/
    unsigned char routeID;     /*route ID:0..19,0xffff:null route ID*/
    unsigned char reserved;    /*default 0x20 */
    char routeName[14];        /*c string,[ 0 .. 9 , A .. Z , ]*/
    char reserved[2];
    unsigned int reserved;
    unsigned int reserved;
    unsigned short reserved;
    unsigned char flag;        /* reserved, default 0x7b */
    unsigned char mark;        /* reserved, default 0x77 */
    T_SUBROUTE subRoutes[9];
} T_ROUTE;

A route(in T_ROUTE type) consists a main route and 1 to maximum 9 subroutes. Its length is variable and depends on the number of subroutes included. The main route only describes the basic attributes. The waypoint IDs is kept in its subroutes. Each subroute (in T_SUBROUTE types) consists 1 to maximum 14 waypoint IDs. A null waypoint ID (0xffff) must be appended after the last waypoint ID(0..999) in the last subroute of a route.

If you happen to send a route with exactly 14 waypoints (or 28…) to the device, you may be better off adding another subroute, filled with 0xffff as waypoints. What is used by the NaviGPS in the second subroute added seems rather random to me. But the NaviGPS adds this second subroute too to represent such a route, so it may be considered good practice?

Track

typedef struct {
    unsigned short serialNum;      /*unique serial number,0..8191*/
    unsigned short headingOfPoint; /*0..360 degree*/
    int x;                         /*UTM x in WGS84 */
    int y;                         /*UTM y in WGS84 */
    T_POSITION position;           /*position in WGS84 datum*/
    T_DATETIME datetime;           /*time, date in UTC*/
    unsigned char zone;            /*UTM zone, 1..60*/
    unsigned char halfspeed;       /*in KMH, actual speed=halfspeed*2 */
    unsigned char tag1;            /*reserved, default 0x5a */
    unsigned char tag2;            /*reserved, default 0x7e */
} T_TRACKPOINT;

Please notice that track points in the track are limited to be in the same UTM zone.

Note: The UTM zone information seems not to be related to the trackpoint and always points to a place somewhere in China?

1)
FIXME should this number be higher? 512 maybe?