Pps-gpio for s905x

Here is a quick synopsis of the procedure I used to get this working -

Physical Connection to the GT-U7 gps module.
5v in, 3.3v pps and serial signals

GPS     7j1 Pin 
Vin ----- 4, 5volts
Gnd ----- 6, Ground
Tx  ----- 5, UART_RX_AO_B
Rx  ----- 7, UART_TX_AO_B
PPS ----- 12, GPIOAO_6 -The magic interrupt



Pre req - Le Potato running - 2022-09-22-raspbian-bullseye-arm64+aml-s905x-cc.img
        - pps-gpio modified for rising edge see post above 

Here we go - 
#apt update
#apt upgrade
#apt install linux-image-6.1.y-lts-irq-arm64
#apt install gpsd
#apt install chronyc
#apt install pps-tools
#git clone https://github.com/libre-computer-project/libretech-wiring-tool.git
#cd libretech-wiring-tool/
#./install.sh
//Overlay modified to use rising edge if interrupt
#ldto merge pps-gpio-7j1-12-rising
#ldto merge uart-ao-b

#reboot

//well lookee here !!
pi@raspberrypi:~ $ dmesg|grep pps
[    0.663946] pps_core: LinuxPPS API ver. 1 registered
[    0.663960] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    8.733323] pps pps0: new PPS source pps-gpio.-1
[    8.733399] pps pps0: Registered IRQ 42 as PPS source
pi@raspberrypi:~ $ 

---------- chrony.conf ------------------
//add the follwing lines, optionally delete unneeded servers/pools
#nano /etc/chrony/chrony.conf 

# PPS from the pps-gpio interrupts
refclock PPS /dev/pps0 refid PPS0 prefer precision 1e-5

# Serial data from ttyAML2.  offset is the estimate of the fraction of
# a second the serial data arrives behind the pps.  Found experimentally. 
refclock SHM 0 refid AML2 offset 0.126 precision 1e-1

-------------------------------------------

-----------gpsd.service file---------------

#nano /usr/lib/systemd/system/gpsd.service 

//Change the Exec line to - 
ExecStart=/usr/sbin/gpsd -n -s 9600 /dev/ttyAML2

--------------------------------------------

#reboot

Hopefully you are golden in 5 or 30 minutes - 

pi@raspberrypi:~ $ chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
#* PPS0                          0   4   377    14   +547ns[ +639ns] +/-   10us
#- AML2                          0   4   377    15  -4707us[-4707us] +/-  100ms
^- time2.google.com              1   8   377   172  -3059us[-3058us] +/-   15ms
^- time-d-b.nist.gov             1   8   377   171  -2999us[-2998us] +/-   12ms
pi@raspberrypi:~ $ 

Thats under 1 us accuracy stratum 1 ntp server for about $50 (Le Potato=$35 + GT-U7=$10)! (Does fluctuate up to 2 or 3 us occasionally)

2 Likes