Changes between Initial Version and Version 1 of OpenWrt/GPS


Ignore:
Timestamp:
10/22/2017 05:28:45 AM (6 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OpenWrt/GPS

    v1 v1  
     1[[PageOutline]]
     2
     3'''For a more general overview of our GPS modules, please see our [wiki:gps Main GPS Page] for more information.'''
     4
     5= Hardware Mappings =
     6Please see [wiki:gps this] page for which serial port the GPS is on
     7
     8
     9= OpenWrt GPS configuration and GPSD =
     10OpenWrt supports the popular opensource {{{gpsd}}} application: http://gpsd.berlios.de/
     11
     12The configuration for gpsd is stored in {{{/etc/config/gpsd}}} and accessible via {{{uci}}}:
     13{{{#!bash
     14uci show gpsd
     15}}}
     16
     17One must configure the following.
     18 1. The port is typically 2947 but can be changed if desired
     19 2. device is where the GPS chip is mapped on the board, please see the [wiki:OpenWrt/GPS#HardwareMappings Hardware Mappings] above
     20 3. To test {{{gpsd}}} from an external computer, you will need to set the {{{listen_globally}}} variable to {{{true}}}. Modify it using a editor like {{{vi}}} or {{{uci}}} commands.
     21
     22Example output:
     23{{{#!bash
     24root@OpenWrt:/# uci show gpsd
     25gpsd.core=gpsd
     26gpsd.core.device=/dev/ttyUSB0
     27gpsd.core.port=2947
     28gpsd.core.listen_globally=false
     29gpsd.core.enabled=true
     30}}}
     31
     32{{{gpsd}}} is a '''service''' and therefore can be started and stopped with the standard commands.
     33{{{#!bash
     34/etc/init.d/gpsd start
     35}}}
     36
     37To verify the GPS data output, you can {{{cat}}} the serial port that the GPS is mapped on. For example, on the GW2388, the GPS is mapped to COM2 port (ttyS2): '''Please view product manual for correct port or [wiki:OpenWrt/GPS#HardwareMappings Hardware Mappings] above'''
     38
     39'''Note''': ''Ventana may spit out binary OSP mode''
     40
     41{{{#!bash
     42root@OpenWrt:/# stty -F /dev/ttyS2 4800 ;# set baudrate to 4800bps, also possibly 9600
     43root@OpenWrt:/# cat /dev/ttyS2
     44
     45$GPGGA,000113.037,,,,,0,0,,,M,,M,,*4F
     46$GPGSA,A,1,,,,,,,,,,,,,,,*1E
     47$GPGSV,1,1,00*79
     48$GPRMC,000113.037,V,,,,,0.00,0.00,060180,19.9,W,N*0D
     49$GPGGA,000113.037,,,,,0,0,,,M,,M,,*4F
     50}}}
     51
     52You can also install a {{{gpsd}}} client such as {{{xgps}}} and test it via an external PC.
     53
     54Example shown below has a Gateworks board at 192.168.1.78 on the network.  A Linux Desktop PC is running at 192.168.1.22 and has {{{xgps}}} installed:
     55{{{#!bash
     56xgps 192.168.1.78
     57}}}
     58[[Image(xgps.png,300px)]]
     59
     60For a '''Windows''' client, please search on Google and refer to the gpsd page where it lists:
     61{{{#!bash
     62Applications that presently use gpsd include pyGPS, gpsdrive, Kismet, GPSdrive, gpeGPS, position, roadmap, roadnav, navit, viking, tangogps, foxtrot, opencpn, obdgpslogger, geohist, LiveGPS, geoclue, qlandkartegt, gpredict, OpenCPN, gpsd-navigator, gpsd-ais-viewer, and firefox/mozilla.
     63}}}
     64
     65
     66= Hardware-specific init scripts =
     67Some hardware may require configuration each time you boot that you likely want place in an init-script.  For example:
     68 * specific AT commands to enable/configure NMEA mode
     69 * software controlled USB steering (for boards that route USB to front-panel by default but need to have USB routed to PCIe slot for a PCIe USB modem with GPS support)
     70
     71
     72== Option Globetrotter GTM671WFS ==
     73The Option Globetrotter modules combine multiple features into a single device.  The GPS module on supported devices has a serial port to control/configure the GPS and another serial port to obtain data from the GPS.  By default the data port does not display NMEA messages and must be enabled with the following AT commands:
     74{{{#!bash
     75AT_OGPSMODE=1
     76AT_OGPS=2
     77}}}
     78
     79An OpenWrt init script can be created for performing this on bootup.  Here we add a UCI configuration {{{ctrl_device}}} to the gpsd configuration to describe the configuration serial port:
     80 * create and enable a gps init script
     81{{{#!bash
     82cat << EOF > /etc/init.d/option_gps_init
     83#!/bin/sh /etc/rc.common
     84# Copyright (C) 2009 OpenWrt.org
     85START=85
     86
     87boot() {
     88    config_load gpsd
     89    config_get ctrl_device core ctrl_device
     90    [ "\$ctrl_device" ] || exit
     91    logger -t "gps" "Initializing GPS on \$ctrl_device"
     92    echo -e -n "AT_OGPSMODE=1\015" > \$ctrl_device
     93    echo -e -n "AT_OGPS=2\015" > \$ctrl_device
     94}
     95EOF
     96chmod +x /etc/init.d/option_gps_init
     97/etc/init.d/option_gps_init enable
     98}}}
     99 * specify UCI config used by the init script above:
     100{{{#!bash
     101uci set gpsd.core.device=/dev/ttyHS1
     102uci set gpsd.core.ctrl_device=/dev/ttyHS2
     103uci set gpsd.core.enabled=true
     104uci commit
     105}}}
     106 * and make sure gpsd is enabled on boot:
     107{{{#!bash
     108/etc/init.d/gpsd enable
     109}}}