Search code examples
raspberry-pigpsuartlineageos

No GPS on Raspberry Pi LineageOS 18.1


UPDATED See edit!

I have installed LineageOS 18.1 for Raspberry Pi 4 (which is an awesome piece of software) and everything seems to be working correctly. With the exception of GPS. I have an A9G connected to the Pi. It is connected to the first Pi's UART and I can see the data coming on ttyAMA0.

:/ # microcom -s 9600 /dev/ttyAMA0 
$GNGGA,092800.998,4955.7547,N,00900.2330,E,0,0,,102.0,M,48.0,M,,*5E
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$BDGSA,A,1,,,,,,,,,,,,,,,*0F
$GPGSV,1,1,00*79
$BDGSV,1,1,00*68
$GNRMC,092800.998,V,4955.7547,N,00900.2330,E,0.000,0.00,211021,,,N*55
$GNVTG,0.00,T,,M,0.000,N,0.000,K,N*2C
$GNGGA,092801.998,4955.7547,N,00900.2330,E,0,0,,102.0,M,48.0,M,,*5F
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$BDGSA,A,1,,,,,,,,,,,,,,,*0F
$GPGSV,1,1,00*79
$BDGSV,1,1,00*68
$GNRMC,092801.998,V,4955.7547,N,00900.2330,E,0.000,0.00,211021,,,N*54
$GNVTG,0.00,T,,M,0.000,N,0.000,K,N*2C
$GNGGA,092802.998,4955.7547,N,00900.2330,E,0,0,,102.0,M,48.0,M,,*5C

I changed the GPS receiver to use ttyAMA0 in /vendor/build.prop

# GPS ro.kernel.android.gps=ttyAMA0

I also trying with adding

ro.kernel.android.gpsttybaud = 9600

or

ro.kernel.android.gps.speed = 9600

But not a single App can receive GPS data. I have the feeling I am missing something very simple but essential.

Any help very appreciated

EDIT Ok, I am a step further. The first problem was apparently, what a bummer, a permission issue. I adjusted it in the file: /vendor/ueventd.rc

From:

/dev/ttyAMA0 0660 bluetooth bluetooth
To:

/dev/ttyAMA0 0660 system radio

Now it seems that the data is being received and correctly interpreted. But when I open a GPS testing App, the signal is flickering. It almost like if something else is reading from ttyACM0.

Is it possible?

just to clarify what I mean with "flickering", please take a look at https://cloud.sobi.pro/f/68f0398aea1549918376/


Solution

  • I recently found this old post of mine and I thought I'd share some of my findings.

    So, the flickering was caused by GLONASS NMEA string ($GLGSV). Basically, GPS and Galileo were reporting "GPS Fix" whilst GLONASS was reporting "No Fix" thus the "flickering".

    The issue, I assume, is that we are not using a dedicated driver but a generic console driver. A proper driver would probably filter the noise out.

    As I switched from my previous setup, Raspberry Pi with LineageOS to a x86 tablet + Fedora + Waydroid, I used socat to create a virtual terminal and used a simple bash script to filter the GLONASS output out of the NMEA string.

    Hope that helps someone.