{"id":16516,"date":"2017-01-27T10:29:16","date_gmt":"2017-01-27T16:29:16","guid":{"rendered":"http:\/\/www.multitech.net\/developer\/?page_id=16516"},"modified":"2022-08-11T15:15:12","modified_gmt":"2022-08-11T20:15:12","slug":"gpsgnss-on-conduit","status":"publish","type":"page","link":"https:\/\/www.multitech.net\/developer\/software\/mlinux\/using-mlinux\/gpsgnss-on-conduit\/","title":{"rendered":"GPS\/GNSS"},"content":{"rendered":"<div class=\"note\">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 <b>NTPD <\/b>for time.<\/div>\n<p>The GPS\/GNSS turns on automatically.<\/p>\n<p><b>Turn off GPSD<\/b><\/p>\n<p>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.<\/p>\n<p>To disable GPSD:<\/p>\n<p style=\"padding-left: 30px;\">1. Change the <b>ENABLED<\/b> variable to <b>no<\/b> in the GPSD configuration file at \/<b>etc\/default\/gpsd<\/b>.<\/p>\n<pre class=\"brush:shell\">ENABLED = \"no\"<\/pre>\n<p style=\"padding-left: 30px;\">2. \u00a0Reboot the device.<\/p>\n<p><b>GNSS\/GPS Reset<\/b><\/p>\n<p>With default configuration, the device resets the GNSS\/GPS on every reboot. After reset it takes some time to lock onto the satellites.<\/p>\n<p>If you want to change this going forward:<\/p>\n<p style=\"padding-left: 30px;\">1. Edit the file \/etc\/default\/mts-io and set GPSGNSSRESET to 0:<\/p>\n<pre class=\"brush:shell\"># GPS GNSS reset when loading driver\r\n# 1 Reset the GPS on driver load (default)\r\n# 0 Do not reset\r\nGPSGNSSRESET=0\r\n# DEBUG\r\n# 0 is off\r\n# 1 is on\r\nDEBUG=0<\/pre>\n<p style=\"padding-left: 30px;\">2. Then reboot.<\/p>\n<p>With GPSGNSSRESET=0, when you power off the device, it resets the GPS.<\/p>\n<p>To manually reset the GPS, enter the following commands:<\/p>\n<pre class=\"brush:shell\">mtcdt: cd \/sys\/devices\/platform\/mts-io\r\nmtcdt: echo 0 &gt;gnss-reset; sleep 1\u00a0; echo 1 &gt;gnss-reset<\/pre>\n<p><b>Default GNSS\/GPS Output<\/b><\/p>\n<p>For the default GNSS\/GPS output, enter the following command below (the following applies to\u00a0mLinux<sup>\u2122<\/sup> 4.0\u00a0 or higher, for earlier versions of mLinux\u00a0 on MTCDT\/MTCDTIP replace all instances of\u00a0<strong>\/dev\/gps0<\/strong>\u00a0with\u00a0<strong>\/dev\/ttyXRUSB2<\/strong>):<\/p>\n<pre class=\"brush:shell\">mtcdt: head \/dev\/gps0<\/pre>\n<p>The resulting output, after you reset the GNSS\/GPS (see <strong>GNSS\/<\/strong><b>GPS Reset<\/b>), includes the current GPS hardware and software versions:<\/p>\n<pre class=\"brush:shell\">$GNTXT,01,01,02,u-blox AG - www.u-blox.com*4E\r\n$GNTXT,01,01,02,HW UBX-M8030 00080000*60\r\n$GNTXT,01,01,02,ROM CORE 3.01 (107888)*2B\r\n$GNTXT,01,01,02,FWVER=SPG 3.01*46\r\n$GNTXT,01,01,02,PROTVER=18.00*11\r\n$GNTXT,01,01,02,GPS;GLO;GAL;BDS*77\r\n$GNTXT,01,01,02,SBAS;IMES;QZSS*49\r\n$GNTXT,01,01,02,GNSS OTP=GPS;GLO*37\r\n$GNTXT,01,01,02,LLC=FFFFFFFF-FFFF7CBF-FFED001A-FFFFFFFF-FFFFFFF9*53\r\n$GNTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*3E\r\n$GNTXT,01,01,02,ANTSTATUS=DONTKNOW*2D\r\n$GNTXT,01,01,02,PF=3FF*4B<\/pre>\n<p><b>GPS Data: Longitude and Latitude<\/b><\/p>\n<p>The GNSS constantly broadcasts location information. The system can provide either GPS or GLONASS data.<\/p>\n<p>To get GPS longitude and latitude:<\/p>\n<p style=\"padding-left: 30px;\">1. Enter the following command to start the output:<\/p>\n<pre class=\"brush:shell\">mtcdt: grep 'GPRMC' \/dev\/gps0<\/pre>\n<p style=\"padding-left: 30px;\">2. To stop the output, hit <b>Ctrl+C<\/b>.<\/p>\n<p style=\"padding-left: 60px;\">The resulting output includes:<\/p>\n<pre class=\"brush:shell\">$GPRMC,153256.00,A,4505.96895,N,09311.74575,W,0.034,,011116,,,D*61\r\n$GPRMC,153355.00,A,4505.96983,N,09311.74598,W,0.057,,011116,,,D*63\r\n$GPRMC,153356.00,A,4505.96982,N,09311.74597,W,0.061,,011116,,,D*6B\r\n$GPRMC,153357.00,A,4505.96980,N,09311.74596,W,0.040,,011116,,,D*6A\r\n$GPRMC,153358.00,A,4505.96976,N,09311.74591,W,0.043,,011116,,,D*68\r\n$GPRMC,153359.00,A,4505.96970,N,09311.74590,W,0.028,,011116,,,D*63\r\n^C<\/pre>\n<p>To get GLONASS longitude and latitude:<\/p>\n<p style=\"padding-left: 30px;\">1. Enter the following command to start the output:<\/p>\n<pre class=\"brush:shell\">mtcdt: grep 'GNRMC' \/dev\/gps0<\/pre>\n<p style=\"padding-left: 30px;\">2. To stop the output, hit <b>Ctrl+C<\/b>.<\/p>\n<p style=\"padding-left: 60px;\">The resulting output includes:<\/p>\n<pre class=\"brush:shell\">$GNRMC,190738.00,A,4505.96409,N,09311.76810,W,0.120,,240117,,,A*7E\r\n$GNRMC,190812.00,A,4505.96567,N,09311.78228,W,0.041,,240117,,,A*79\r\n$GNRMC,190813.00,A,4505.96563,N,09311.78280,W,0.013,,240117,,,A*79\r\n$GNRMC,190814.00,A,4505.96558,N,09311.78294,W,0.037,,240117,,,A*75\r\n^C<\/pre>\n<p style=\"padding-left: 30px;\">3. To receive a single line of GPS location data, enter to the following command:<\/p>\n<pre class=\"brush:shell\">mtcdt: grep 'GPRMC' \/dev\/gps0 | head -1<\/pre>\n<p>For a single line of GLONASS data, simply replace <b>GPRMC<\/b> with <b>GNRMC <\/b>in the above command<b>.<\/b><\/p>\n<p>For either GPS or GLONASS data, enter the following command (the system outputs whichever signal is stronger):<\/p>\n<pre class=\"brush:shell\">mtcdt: egrep 'GPRMC|GNRMC' \/dev\/gps0<\/pre>\n<p><b>Save GPS data to file for sending<\/b><\/p>\n<p><b>\u00a0<\/b>Using <b>cat<\/b>, you can print the data from the GPS. Then direct the output to the <b>tee<\/b> program where data is simultaneously written to the screen and to the text file, <b>\/tmp\/log.txt<\/b>.<\/p>\n<p>To save the GPS data to a file and transfer it:<\/p>\n<p style=\"padding-left: 30px;\">1. Enter the following command to display and save the GPS data to the <b>log.txt<\/b> file:<\/p>\n<pre class=\"brush:shell\">mtcdt: cat \/dev\/gps0 | tee \/tmp\/log.txt<\/pre>\n<p style=\"padding-left: 60px;\">The resulting output looks like this:<\/p>\n<pre class=\"brush:shell\">$GNRMC,174707.00,A,4505.96258,N,09311.78126,W,0.039,,260117,,,D*76\r\n$GNVTG,,T,,M,0.039,N,0.072,K,D*37\r\n$GNGGA,174707.00,4505.96258,N,09311.78126,W,2,12,0.67,297.9,M,-31.0,M,,0000*7D\r\n$GNGSA,A,3,48,10,11,24,32,22,12,25,51,01,18,14,1.48,0.67,1.32*17\r\n$GNGSA,A,3,84,83,68,69,,,,,,,,,1.48,0.67,1.32*16\r\n$GPGSV,4,1,14,01,23,315,35,10,63,123,29,11,22,293,37,12,20,074,27*7C\r\n$GPGSV,4,2,14,14,,76,04,020,*66\r\n$GLGSV,3,2,10,77,49,057,,78,45,152,,79,12,179,,83,17,247,36*69\r\n$GLGSV,3,3,10,84,25,304,29,85,06,351,23*6E\r\n$GNGLL,4505.96161,N,09311.78230,W,174730.00,A,D*6F\r\n^C<\/pre>\n<p style=\"padding-left: 30px;\">2. Here are two ways to transfer the <b>log.txt<\/b> file:<\/p>\n<p style=\"padding-left: 60px;\">a. Transfer <b>\/tmp\/log.txt<\/b> via Ethernet using an SCP program (like WinSCP) to save on your local computer<\/p>\n<p style=\"padding-left: 60px;\"><strong>OR<\/strong><\/p>\n<p style=\"padding-left: 60px;\">b. \u00a0Save to a USB memory stick or flash drive. The device mounts the memory stick in the <b>\/media<\/b> directory. The system names the drive <b>sda1, sda2, sda3<\/b>, and so forth for each partition. In this case, the file ends up in <b>\/media\/sda1\/log.txt<\/b>. To copy and move <b>tmp\/log.txt <\/b>to the USB stick, enter the following commands:<\/p>\n<pre class=\"brush:shell\">mtcdt: cp \/tmp\/log.txt \/media\/sda1\/log.txt<\/pre>\n<p style=\"padding-left: 60px;\">Safely remove the USB stick:<\/p>\n<pre class=\"brush:shell\">mtcdt: umount \/media\/sda1<\/pre>\n<p><b>PPS (pulse per second) <\/b><\/p>\n<p>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.<\/p>\n<p>For an explanation of PPS, refer to: <a href=\"https:\/\/www.kernel.org\/doc\/Documentation\/pps\/pps.txt\">https:\/\/www.kernel.org\/doc\/Documentation\/pps\/pps.txt<\/a>.<\/p>\n<p>To use PPS:<\/p>\n<p style=\"padding-left: 30px;\">1. First verify the pps drivers are loaded by entering the following command:<\/p>\n<pre class=\"brush:shell\">mtcdt: lsmod | grep pps<\/pre>\n<p style=\"padding-left: 60px;\">\u00a0The results should include:<\/p>\n<pre class=\"brush:shell\">pps_gpio\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2303\u00a0 0\r\npps_core\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 6967\u00a0 1 pps_gpio<\/pre>\n<p style=\"padding-left: 30px;\">2. To run a test:<\/p>\n<pre class=\"brush:shell\">mtcdt: { ppstest \/dev\/pps0 &amp; }\u00a0; sleep 5\u00a0; kill\u00a0%1\r\n[1] 2695<\/pre>\n<p style=\"padding-left: 60px;\">The results should include:<\/p>\n<pre class=\"brush:shell\">trying PPS source \"\/dev\/pps0\"\r\nfound PPS source \"\/dev\/pps0\"\r\nok, found 1 source(s), now start fetching data...\r\nsource 0 - assert 1477436494.893610586, sequence: 27955 - clear\u00a0 1477436493.993620255, sequence: 27954\r\nsource 0 - assert 1477436494.893610586, sequence: 27955 - clear\u00a0 1477436494.993605255, sequence: 27955\r\nsource 0 - assert 1477436495.893594626, sequence: 27956 - clear\u00a0 1477436494.993605255, sequence: 27955\r\nsource 0 - assert 1477436495.893594626, sequence: 27956 - clear\u00a0 1477436495.993592115, sequence: 27956\r\nsource 0 - assert 1477436496.893572306, sequence: 27957 - clear\u00a0 1477436495.993592115, sequence: 27956\r\nsource 0 - assert 1477436496.893572306, sequence: 27957 - clear\u00a0 1477436496.993670234, sequence: 27957\r\nsource 0 - assert 1477436497.893555145, sequence: 27958 - clear\u00a0 1477436496.993670234, sequence: 27957\r\nsource 0 - assert 1477436497.893555145, sequence: 27958 - clear\u00a0 1477436497.993553174, sequence: 27958\r\nsource 0 - assert 1477436498.893538825, sequence: 27959 - clear\u00a0 1477436497.993553174, sequence: 27958\r\nsource 0 - assert 1477436498.893538825, sequence: 27959 - clear\u00a0 1477436498.993535594, sequence: 27959<\/pre>\n<p style=\"padding-left: 30px;\">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\u2019s low.<\/p>\n<p><b>GNSS\/GPS Chip Information<\/b><\/p>\n<p>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 <b>\/dev\/gps0<\/b>. The USB hub uses EXAR\/Vizzini as the USB driver:<br \/>\n<span style=\"font-family: 'andale mono', times;\"><br \/>\n<\/span><\/p>\n<pre class=\"brush:shell\">Bus 001 Device 002: ID 0424:2534 Standard Microsystems Corp.\r\nBus 002 Device 002: ID 04e2:1414 Exar Corp.<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1478,"featured_media":0,"parent":9184,"menu_order":10,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-16516","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/16516","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/users\/1478"}],"replies":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/comments?post=16516"}],"version-history":[{"count":58,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/16516\/revisions"}],"predecessor-version":[{"id":16588,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/16516\/revisions\/16588"}],"up":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/9184"}],"wp:attachment":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/media?parent=16516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}