GPS/GNSS

This feature is only available on certain products and models (not available with all devices). This section focuses on the location capability of the GNSS and PPS (pulse per second). Please refer to NTPD for time.

The GPS/GNSS turns on automatically.

Turn off GPSD

Before entering any of the commands in this section, if your unit has GPSD (firmware version 3.2.5 or higher), you must disable it.

To disable GPSD:

1. Change the ENABLED variable to no in the GPSD configuration file at /etc/default/gpsd.

ENABLED = "no"

2.  Reboot the device.

GNSS/GPS Reset

With default configuration, the device resets the GNSS/GPS on every reboot. After reset it takes some time to lock onto the satellites.

If you want to change this going forward:

1. Edit the file /etc/default/mts-io and set GPSGNSSRESET to 0:

# GPS GNSS reset when loading driver
# 1 Reset the GPS on driver load (default)
# 0 Do not reset
GPSGNSSRESET=0
# DEBUG
# 0 is off
# 1 is on
DEBUG=0

2. Then reboot.

With GPSGNSSRESET=0, when you power off the device, it resets the GPS.

To manually reset the GPS, enter the following commands:

mtcdt: cd /sys/devices/platform/mts-io
mtcdt: echo 0 >gnss-reset; sleep 1 ; echo 1 >gnss-reset

Default GNSS/GPS Output

For the default GNSS/GPS output, enter the following command below (the following applies to mLinux 4.0  or higher, for earlier versions of mLinux  on MTCDT/MTCDTIP replace all instances of /dev/gps0 with /dev/ttyXRUSB2):

mtcdt: head /dev/gps0

The resulting output, after you reset the GNSS/GPS (see GNSS/GPS Reset), includes the current GPS hardware and software versions:

$GNTXT,01,01,02,u-blox AG - www.u-blox.com*4E
$GNTXT,01,01,02,HW UBX-M8030 00080000*60
$GNTXT,01,01,02,ROM CORE 3.01 (107888)*2B
$GNTXT,01,01,02,FWVER=SPG 3.01*46
$GNTXT,01,01,02,PROTVER=18.00*11
$GNTXT,01,01,02,GPS;GLO;GAL;BDS*77
$GNTXT,01,01,02,SBAS;IMES;QZSS*49
$GNTXT,01,01,02,GNSS OTP=GPS;GLO*37
$GNTXT,01,01,02,LLC=FFFFFFFF-FFFF7CBF-FFED001A-FFFFFFFF-FFFFFFF9*53
$GNTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*3E
$GNTXT,01,01,02,ANTSTATUS=DONTKNOW*2D
$GNTXT,01,01,02,PF=3FF*4B

GPS Data: Longitude and Latitude

The GNSS constantly broadcasts location information. The system can provide either GPS or GLONASS data.

To get GPS longitude and latitude:

1. Enter the following command to start the output:

mtcdt: grep 'GPRMC' /dev/gps0

2. To stop the output, hit Ctrl+C.

The resulting output includes:

$GPRMC,153256.00,A,4505.96895,N,09311.74575,W,0.034,,011116,,,D*61
$GPRMC,153355.00,A,4505.96983,N,09311.74598,W,0.057,,011116,,,D*63
$GPRMC,153356.00,A,4505.96982,N,09311.74597,W,0.061,,011116,,,D*6B
$GPRMC,153357.00,A,4505.96980,N,09311.74596,W,0.040,,011116,,,D*6A
$GPRMC,153358.00,A,4505.96976,N,09311.74591,W,0.043,,011116,,,D*68
$GPRMC,153359.00,A,4505.96970,N,09311.74590,W,0.028,,011116,,,D*63
^C

To get GLONASS longitude and latitude:

1. Enter the following command to start the output:

mtcdt: grep 'GNRMC' /dev/gps0

2. To stop the output, hit Ctrl+C.

The resulting output includes:

$GNRMC,190738.00,A,4505.96409,N,09311.76810,W,0.120,,240117,,,A*7E
$GNRMC,190812.00,A,4505.96567,N,09311.78228,W,0.041,,240117,,,A*79
$GNRMC,190813.00,A,4505.96563,N,09311.78280,W,0.013,,240117,,,A*79
$GNRMC,190814.00,A,4505.96558,N,09311.78294,W,0.037,,240117,,,A*75
^C

3. To receive a single line of GPS location data, enter to the following command:

mtcdt: grep 'GPRMC' /dev/gps0 | head -1

For a single line of GLONASS data, simply replace GPRMC with GNRMC in the above command.

For either GPS or GLONASS data, enter the following command (the system outputs whichever signal is stronger):

mtcdt: egrep 'GPRMC|GNRMC' /dev/gps0

Save GPS data to file for sending

 Using cat, you can print the data from the GPS. Then direct the output to the tee program where data is simultaneously written to the screen and to the text file, /tmp/log.txt.

To save the GPS data to a file and transfer it:

1. Enter the following command to display and save the GPS data to the log.txt file:

mtcdt: cat /dev/gps0 | tee /tmp/log.txt

The resulting output looks like this:

$GNRMC,174707.00,A,4505.96258,N,09311.78126,W,0.039,,260117,,,D*76
$GNVTG,,T,,M,0.039,N,0.072,K,D*37
$GNGGA,174707.00,4505.96258,N,09311.78126,W,2,12,0.67,297.9,M,-31.0,M,,0000*7D
$GNGSA,A,3,48,10,11,24,32,22,12,25,51,01,18,14,1.48,0.67,1.32*17
$GNGSA,A,3,84,83,68,69,,,,,,,,,1.48,0.67,1.32*16
$GPGSV,4,1,14,01,23,315,35,10,63,123,29,11,22,293,37,12,20,074,27*7C
$GPGSV,4,2,14,14,,76,04,020,*66
$GLGSV,3,2,10,77,49,057,,78,45,152,,79,12,179,,83,17,247,36*69
$GLGSV,3,3,10,84,25,304,29,85,06,351,23*6E
$GNGLL,4505.96161,N,09311.78230,W,174730.00,A,D*6F
^C

2. Here are two ways to transfer the log.txt file:

a. Transfer /tmp/log.txt via Ethernet using an SCP program (like WinSCP) to save on your local computer

OR

b.  Save to a USB memory stick or flash drive. The device mounts the memory stick in the /media directory. The system names the drive sda1, sda2, sda3, and so forth for each partition. In this case, the file ends up in /media/sda1/log.txt. To copy and move tmp/log.txt to the USB stick, enter the following commands:

mtcdt: cp /tmp/log.txt /media/sda1/log.txt

Safely remove the USB stick:

mtcdt: umount /media/sda1

PPS (pulse per second)

PPS is an optional feature from the pps-tools package installed on the device. If you want to use a timer, the PPS is the most accurate way to time an interval. It measures an electrical pulse every second using the kernel PPS driver code.

For an explanation of PPS, refer to: https://www.kernel.org/doc/Documentation/pps/pps.txt.

To use PPS:

1. First verify the pps drivers are loaded by entering the following command:

mtcdt: lsmod | grep pps

 The results should include:

pps_gpio                2303  0
pps_core                6967  1 pps_gpio

2. To run a test:

mtcdt: { ppstest /dev/pps0 & } ; sleep 5 ; kill %1
[1] 2695

The results should include:

trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1477436494.893610586, sequence: 27955 - clear  1477436493.993620255, sequence: 27954
source 0 - assert 1477436494.893610586, sequence: 27955 - clear  1477436494.993605255, sequence: 27955
source 0 - assert 1477436495.893594626, sequence: 27956 - clear  1477436494.993605255, sequence: 27955
source 0 - assert 1477436495.893594626, sequence: 27956 - clear  1477436495.993592115, sequence: 27956
source 0 - assert 1477436496.893572306, sequence: 27957 - clear  1477436495.993592115, sequence: 27956
source 0 - assert 1477436496.893572306, sequence: 27957 - clear  1477436496.993670234, sequence: 27957
source 0 - assert 1477436497.893555145, sequence: 27958 - clear  1477436496.993670234, sequence: 27957
source 0 - assert 1477436497.893555145, sequence: 27958 - clear  1477436497.993553174, sequence: 27958
source 0 - assert 1477436498.893538825, sequence: 27959 - clear  1477436497.993553174, sequence: 27958
source 0 - assert 1477436498.893538825, sequence: 27959 - clear  1477436498.993535594, sequence: 27959

Note that the above time is UNIX epoch time and indicates when the kernel noticed the transition of the PPS signal. This data samples the PPS. The kernel timestamps each PPS signal. The assert label indicates a high signal and the clear label indicates when it’s low.

GNSS/GPS Chip Information

The device offers GPS data through a serial port. For the hardware, GNSS/GPS is on USB virtual serial port 3 (numbered 1 to 4 in schematics). But in the software, the USB serial ports are numbered 0 through 3. As a result, the GNSS/GPS unit is on port # 2 in the software. The serial port TTY is therefore /dev/gps0. The USB hub uses EXAR/Vizzini as the USB driver:

Bus 001 Device 002: ID 0424:2534 Standard Microsystems Corp.
Bus 002 Device 002: ID 04e2:1414 Exar Corp.