Hi!
I’m building a GNSS/GPS disciplined (stratum 1) network time server and need to feed the PPS (Pulse Per Second) into a GPIO pin. I’m using a BPi-M2 Zero (Allwinner H2+/H3 SoC) and a u-blox NEO-6M via UART3
, with Armbian Linux 24.2.1 (Ubuntu/Jammy).
This is how i’ve resolved the issue. You can look at older versions of this post if you want to see the problem.
It is not required to write and compile a complicated device tree overlay (DTS/DTO/DTBO).
My /boot/armbianEnv.txt
verbosity=1
bootlogo=false
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
rootdev=UUID=[redacted]
rootfstype=ext4
user_overlays=bananapi-m2-zero-eth0
overlays=i2c1 pps-gpio uart3
param_pps_pin=PA16
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
pps-gpio
defines the driver name. param_pps_pin=PA16
refers to GPIO18, which is pin 12 on the 40-pin header (CON2), also known as PA16/SPI1_MISO/UART3_CTS/PA_EINT16
in the schematic.
The kernel knows what to do with it.
user@banana:~$ dmesg | grep pps
[ 0.729786] pps_core: LinuxPPS API ver. 1 registered
[ 0.729797] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[ 9.135007] pps pps0: new PPS source [email protected]
[ 9.135142] pps pps0: Registered IRQ 57 as PPS source
[ 109.071165] pps_ldisc: PPS line discipline registered
[ 109.073945] pps pps1: new PPS source serial3
[ 109.074062] pps pps1: source "/dev/ttyS3" added
user@banana:~$ lsmod | grep pps
pps_ldisc 16384 2
pps_gpio 12288 0
ppstest
gets useful data, once the u-blox is warmed up.
user@banana:~$ sudo ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1710800322.998550998, sequence: 4264 - clear 0.000000000, sequence: 0
source 0 - assert 1710800323.998539513, sequence: 4265 - clear 0.000000000, sequence: 0
source 0 - assert 1710800324.998561318, sequence: 4266 - clear 0.000000000, sequence: 0
source 0 - assert 1710800325.998549750, sequence: 4267 - clear 0.000000000, sequence: 0
Credits: thank you, Konstantin from Austria (not Australia ), who pointed me in the right direction. He made 2 videos about his project: https://www.youtube.com/watch?v=tSesbsUGvmU and https://www.youtube.com/watch?v=ELKOLY2P5c4. He used an Orange Pi, but it’s the same Allwinner H3 SoC.