I got the option of the pps-generator, that @RobertCNelson pointed out earlier, somewhat working on the beaglebone black on a custom 5.10.162 Kernel . But it s not very consistent. Nearly every 5-10th Pulse goes missing. Sometimes even every 3rd.
I can share the exact steps to build the custom kernel, adding the driver and adding the overlay for the specified pin, if anyone needs that. But in essence, I put the files from damon-kwok into the correct places in BB-Kernel, build the driver as a module(I had some problems when it was build into the kernel), replaced the boot Image with the new build Image and added a Device Tree Overlay. The devicetree overlay seems to autoload the pps-gen module when booting.
I stumbled upon another repo by damon-kwok that seems to be based of jsln.
The main difference I saw is that the time was changed from “timespec” to “timespec64” and instead of “getnstimeofday” “ktime_get_real_ts64” is used. I am not very versed in kernel drivers and don’t know the difference. The only reason I used damon-kwok’s repo is that I saw his first.
I am using a GPS module to generate and synchronize the BBB with Chrony. The time difference between the GPS Pulse and the generated Pulse is ~150us . Depending on your application this might already be enough.
For this I had to compile the pps-generator driver into the Kernel. So using the “normal” Kernel image provided by BeagleBone is not an option. Additionally, I created an Device Tree Overlay that can be loaded to use the driver, instead of editing another device tree file, like it is done in damon-kwok. The overlay file is here BB-BONE-P9_16-PPS-GEN.dts (1.3 KB)
I also tried to use this driver on the BeagleBone AI64 but there it does not seem to work properly.
I have appended some images from my oscilloscope so you can see the difference between the Generated PPS Signal (Channel 1 yellow) and the PPS-Signal from the Module (Channel 2 blue).
Unsychonized:
-
Remark that the 5th. pulse is missing. The driver prints “We are late this time[…]” to dmesg everytime this happens. Maybe someone can a have look at the driver. I am trying to see if this can be resolved aswell.
Synchronized:
But when the PPS is generated it works okay. The pulsewidth may need to be adjusted in the driver.
Update
Currenlty, I have experienced some problems using the current pps-gen driver. BeagleBone-Black crashes when restarting chrony.service when using custom kernel - #3 by benedict.hewson
There is a workaround if you encounter the same errors, described in the thread above.
Removing the pps_gen_gpio kernel module before restarting chrony and once chrony is up an running reinsterting the module works aswell.
Update 2
I have the same setup running on BB-AI64. Here the generated PPS-Pulse is way more consistent and closer to the original pps of the gps module. Probably because of the higher computional power. But sometimes some pps signals are lost but way less than with the BBB. A custom kernel is required here aswell. I made another Device Tree Overlay for the BeagleBone AI64:
BBAI64-P9_16-PPS-GEN.dts (814 Bytes)
Another problem popped up here: I had to remove and reinsert the pps_gen_gpio module in order to receive the generated PPS Signal. The signal is generated shortly after boot, but stops after ~4 seconds.
The following pictures show 2 PPS signals from two seperate gps-modules (Channel2 green and Channel4 blue) and both generated pps signals from BBB(Channel1 yellow) and BBAI64(Channel3 purple).
And just for the sake of completness: The time difference from the two gps pps signals. Only roughly 90ns!
The driver needs some love but in principle works fine.