On Fri, Nov 06, 2020 at 07:44:30AM -0800, Richard Cochran wrote: > Also, IIRC your MAC, the FEC, does not produce a "real" PPS output > generated in Hardware. Instead, the driver does it, resulting in a > very jittery PPS signal.
I don't have an i.MX either, but I do happen to have documentation for it. So take what I'm going to say with a grain of salt. My books are telling me that the FEC has a number of Timer Channels that can be configured via ENET_TCSRn[TMODE] for the Output Compare function. When the 1588 timer exceeds the comparison value, it can emit a pulse (active high or low) for one 1588 clock cycle. This Output Compare register is periodically re-triggered from the IRQ that fires on its expiry. But even if I'm reading the documentation correctly, maybe we're looking at the problem all wrong, and we're asking a bird to swim or a fish to fly. It is not _necessary_ for the FEC to emit actual Pulses Per Second. It's just that this is what we have today in the kernel API: periodic output. So hardware that is not thought out to deliver periodic output is forced by the driver to do that, to comply with the API. But for synchronization with an external device, all that is needed is to know what the time is that the pulse was emitted at, in two time bases: the time base of the emitter (t1), and in the time base of the receiver (t2). Then, the receiver offset is simply (t2 - t1), if the receiver is what you want to synchronize, or the offset is (t1 - t2), if the emitter is what you need to synchronize. Of course, currently ts2phc only offloads the task of emitting periodic output to the kernel, but in principle, it could really make use of an API where it would send the PTP_PEROUT_REQUEST2 ioctl with the PTP_PEROUT_ONE_SHOT flag to the kernel, plus a new extension where user space can poll for a confirmation event containing the completion time (t1) of this request. I think it would be useful in a larger context if Yvonne would spend the time to sit down to make this work and design a nice API for it. The problem with the output being jittery would disappear then, if I understand everything correctly. There's no hurry to rearm, when the operation is finished it's finished. _______________________________________________ Linuxptp-users mailing list Linuxptp-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-users