GL-MiFi. How to repurpose serial console for GPS module using gpsd

Hi,

I’m working on a project using a GL-MiFi and Arduino GPS module (XC3712 with NEO6M2 receiver) in order to have GPS data be available for devices behind my MiFi.

I want to repurpose the serial console interface of the MiFi to accept NMEA strings from the GPS module.

I’ve attached the GPS module and using dmesg can see it advertised as /dev/ttyATH0.

Using minicom and setting my terminal settings I can see NMEA stings coming through (same as using cat /dev/ttyATH0).

Next I installed gpsd and gpsd-clients (for testing). The issue currently looks to be the ttyATH0 port is being consumed by another process which is preventing gpsd from connecting to the port. For instance if I’m running cgps I get no data received and eventually cgps times out, but in another shell I run minicom and some NMEA data gets delivered to gpsd when it first starts but then ceases after 1-2 seconds, then closing minicom there is another trickle of NMEA data to gpsd (verified by full 3D GPS lock in cgps) but then ceases after 1-2 seconds. This suggests to me something is grabbing the port once minicom hangs up its session.

I’ve referenced this link: OpenWrt Forum Archive and How to terminate console on serial port (UART) [Old OpenWrt Wiki] which gives details on disabling the console but haven’t had any luck getting gpsd to attach onto the serial console (ttyATH0) without using minicom to initiate and hang up which trickles through a little bit of NMEA data.

Some config outputs to try and disable any process from using the serial console:
cat /etc/inittab
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
#::askconsole:/bin/ash --login

cat /etc/sysctl.conf
#Defaults are configured in /etc/sysctl.d/* and can be customized in this file
kernel.printk = 0 4 1 7

Tried a couple of options in: /etc/rc.local (last few lines):
/usr/sbin/gpsd -G /dev/ttyATH0
stty -F /dev/ttyATH0 4:0:18b2:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
both now commented out.

gpsd config:
gpsd.core=gpsd
gpsd.core.enabled=‘1’
gpsd.core.device=‘/dev/ttyATH0’
gpsd.core.port=‘2947’
gpsd.core.listen_globally=‘1’

Any thoughts?

1 Like

Where do you install the GPS module in the MIFI?
How is the GPS antenna connected?

Commented on the thread instead of replying to you.

There are 4 serial header pins, 3.3v, TX, RX, GND. The module is attached to this. I assume the physical cabling of the module is fine as I can get raw NMEA using a terminal emulator. Does that make sense?

Keep in mind that the linux console is going to grab the ttyATH0 port… that’s your problem.

I’ve done Neo7 GPS on AR150 via USB rather than the AR9331 console - blue wired PP1S over DCD on the USB-UART converter (the MAC-1x mod) - USB-UART provides another input there…

Stable enough…

Anyways - with the GL-MiFi - check the modem module - you might be able to get GNSS/PP1S from it over USB on the interface there - most modules are USB

Good call. Ive got the EC25 module fitted which supports GNSS.
dmesg | grep tty
[ 18.740082] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB0
[ 18.753325] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB1
[ 18.766559] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB2
[ 18.779676] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB3

Looks like I need to enable GNSS through a serial of AT commands, like “AT+QGPS”.

Not sure how to send those commands to the LTE module through OpenWRT. Any ideas?

You can use the AT command interface on the web to send commands

Thank you, that works. Having mixed results inputting AT commands.
Referencing the EC25 AT command manual and not sure why I’m getting invalid parameter messages.

Show current settings: AT+QGPSCFG=?
+QGPSCFG: “outport”,(“none”,“usbnmea”,“uartdebug”)
+QGPSCFG: “nmeasrc”,(0,1)
+QGPSCFG: “gpsnmeatype”,(0-31)
+QGPSCFG: “glonassnmeatype”,(0-7)
+QGPSCFG: “galileonmeatype”,(0,1)
+QGPSCFG: “beidounmeatype”,(0-3)
+QGPSCFG: “gsvextnmeatype”,(0,1)
+QGPSCFG: “gnssconfig”,(0-6)
+QGPSCFG: “odpcontrol”,(0-2)
+QGPSCFG: “dpoenable”,(0,1)
+QGPSCFG: “plane”,(0-2)
+QGPSCFG: “autogps”,(0,1)
+QGPSCFG: “suplver”,(1,2)
+QGPSCFG: “agpsposmode”,(0-4294967295)
+QGPSCFG: “lbsapn”,(0-31),(0-4),
+QGPSCFG: “agnssprotocol”,(0-255),(0-65535)
+QGPSCFG: “appidname”,,

Enabling: AT+QGPS=1
OK

Enable acquisition of NMEA sentences: AT+QGPSCFG=“nmeasrc”,1
+CME ERROR: 501 (501 Invalid parameter(s))

Perhaps I need to wait for a lock first?
AT+QGPSLOC?
+CME ERROR: 516 (516 Not fixed now)

Kind of following my nose here so any input appreciated.

Edit: disregard, CME errors for parameters is due to the quotation marks copied from the AT command manual, looks like they’re an invalid character. Replacing with " (not “) worked.

1 Like

For anyone searching for a solution. In my use case I used the GNSS interface provided by the LTE module (EP25, and EP06). You need to send AT commands to enable and configure the GNSS service, the AT commands can be sent from the UI as mentioned in luochongjun’s post.

Thanks for the help guys.

1 Like