0

Is there a way to have Chrony accept an externally generated clock pulse ?

For example, I want to use the Canadian radio time source CHU to provide ticks on the second. Assume that I have the required hardware to receive the signal and have a fast C program to isolate the signal I want (1 KHz tone pulse demarcating seconds) and provide the data to pipe.

I only need the clock to be synchronized to the second, not the exact time.

Does Chrony have a mechanism to accept a one second periodic correction pulse ?

wbg
  • 103
  • 4

1 Answers1

1

Yes. It's even covered in their FAQ.

It's called pulse per second. Generally, you provide the pulse to the kernels pps interface, which handles using interrupts. Reading it in userspace is likely to introduce a lot of jitter, as you're not able to poll it consistently enough.

vidarlo
  • 3,775
  • 1
  • 12
  • 25
  • I didn't make the connection with PPS I'm super new to time sync. Any idea if there's a kernel module for this type of thing ? I'll going to search but it's harder when you're a newbie. Thanks. – wbg Jun 01 '22 at 23:22
  • [Yes](https://www.kernel.org/doc/html/latest/driver-api/pps.html). – vidarlo Jun 02 '22 at 07:20
  • I found that one. That doc says I need to apply the PPS to a time stamp myself. Was hoping for something with less work. Like just pointing Chrony to a PPS source and it's done. – wbg Jun 02 '22 at 14:30
  • That's basically what you do. You configure it to use the PPS source. – vidarlo Jun 02 '22 at 19:22
  • Are you saying, I add the PPS config source and then chrony uses it along with the internal clock together all by itself ?? That would be doable at my level of C. It's going to be hard enough to get the stream from the USB audio input and filter it. – wbg Jun 03 '22 at 04:31
  • 1
    You probably don't want to run PPS over USB. USB has jitter; it's a packet based protocol. And you absolutely don't want to process it in userspace. You want your PPS signal to hit a I/O line with interrupt support in the CPU, e.g. serial port or GPIO. Either go with e.g. a GPS providing a PPS, or stick to NTP servers. What you propose is likely to decrease the quality of your clock. – vidarlo Jun 03 '22 at 06:07
  • I understand the need for a kernel space driver and being determinant. This project is to support HAM radio requirement for accurate to 1 second clock when no GPS is available. I have a dongle but it could be lost or broken or the GPS signals turned off for some reason. My radio is the source of the 14.6 MHz signal and the audio is accessed via USB UART converter. I wish I had a true serial port on the laptop I want to use. Thanks for you help. – wbg Jun 03 '22 at 16:43