AM3358: ts2phc + GNSS (NMEA + 1PPS) high precission PPS input (AM3358 testing, target AM62x)

Part Number: AM3358

Tool/software:

Hi,

We're currently working on a PTP time server that will use GNSS (NMEA + 1PPS) as the time source. The final target is AM62x, but we’re doing development and experiments on an AM3358 BeagleBone Black first. I’d appreciate a short reality-check / guidance so we take the right approach before porting to AM62x.

Short summary

  • Board: BeagleBone Black (AM3358) — kernel: Linux BeagleBone 5.10.168-ti-r71

  • Goal: use GNSS NMEA (UART) + 1PPS to discipline a PHC via ts2phc (and then phc2sys - system clock). Nano-second class accuracy is desired.

  • Problem: GPIO-based pps-gpio gives poor jitter and is not acceptable for final solution. We need hardware timestamps (CPTS/timer capture).

What we’ve tried (quick list)

  • Used GPS NMEA on UART4 (P9.11/P9.13) — NMEA is fine.

  • Tried PPS on a GPIO (pps-gpio - /dev/pps0). Confirmed /dev/pps0 works but timestamps are noisy. ts2phc generic with GPIO gave no locking. ("poll returns zero, no events")

  • Investigated timer/timer-capture paths (Timer4 on P8_07 etc.) and Dan Drown’s pps-gmtimer project (timer-capture - PPS). Attempted to build/use pps-gmtimer, hit kernel/compatibility problems on 5.10-ti. (github.com/.../)

  • Tried writing DT overlays (timer PWM vs capture) to route a timer pin to CPTS, and experimented with cpts-ext-ts-inputs / ti,pps ideas. /sys/class/ptp/ptp0/n_external_timestamps : (PHC reports 4 external timestamp inputs), but we don’t yet get any CPTS timestamps from our GPS PPS pin.

  • We deliberately avoided pps-gpio long-term; we want the PPS routed into hardware timestamping (PHC) rather than software edges.

    Questions:
  1. Recommended approach for AM3358: For a project that will later be moved to AM62x, do you recommend (A) using CPSW/CPTS external timestamp inputs directly by wiring PPS to the CPTS-capable pin (if so, how to capture the signals), or (B) using timer-capture (TimerX capture) + a small kernel driver (like pps-gmtimer) that exposes /dev/pps0? Which approach is TI’s recommended/best-supported path for GNSS 1PPS - PHC on AM335x and portable to AM62x?

  2. Pin - HW_TS_PUSH mapping: On AM3358 (BeagleBone) which physical header pins are safe / canonical to use for CPTS external timestamps (HW_TS_PUSH)? We saw n_external_timestamps=4; how do we reliably map a chosen pin (e.g. P8_07 - timer4) to the ts_input index (the pin_index used by ts2phc)? Is there a canonical doc/page with the exact TIMESYNC router / input indices for AM3358?

  3. Device Tree properties: TI docs mention cpts-ext-ts-inputs and ti,pps style DT properties. Can you share a minimal, canonical DT snippet for AM3358 that: (a) preserves UART4 for NMEA, (b) routes Timer4 (or a CPTS-capable pad) as an external TS input for PHC (and indicates how the kernel exposes the ts_input index)? 

  4. ts2phc pin_index mechanics: How should we choose --ts2phc.pin_index? Which sysfs entries (exact path/file) should we inspect to verify pin_index -physical pin mapping? 

  5. AM62x migration notes: For AM62x, the docs mention CP_GEMAC_CPTS0_HW1TSPUSH and the timesync_router changes. Is there a direct mapping approach we should follow to make our AM3358 DT changes portable to AM62x (i.e., we’d like a small list of steps or DT patterns to replicate on AM62x).


    What I’m asking from you

  • A short recommendation which approach to pursue on AM3358 (CPTS direct pin routing vs timer-capture + small driver) — pros/cons.

  • A minimal, tested DT pattern or a pointer to the canonical sample that shows mapping of physical pad -HW_TS_PUSH input for AM3358.

Thanks in advance for any pointers or short snippets you can share, even a one-paragraph “do X with Y pin and set DT property Z” will be extremely helpful for us to unblock the next test iteration.

  • Hello Veysel,

    Apologies for the delayed response. In the future, feel free to ping the thread if it goes a few days without anything from my side - that brings your thread back up in my queue.

    Suggest developing on AM62x, not AM335x

    The time sync connections for AM335x are a bit different than on AM62x (for example, no time sync router). In general, I would suggest developing for AM62x on an AM62x board. The Starter kit is an option for ~$200, or you could go with a community board like the AM62x BeaglePlay for $100. I have used both. The additional $100 spent will yield more than $100 saved in development porting effort.

    CPTS can be used to generate PPS output 

    As discussed separately, GPIO is not a good option for a stable PPS output. It is too noisy.

    PTP... over UART? 

    Help me understand what you are doing here.

    Usually I am thinking about doing PTP to synchronize the Linux system time with an external time master over Ethernet. Then the linuxptp software can handle doing the math with timestamps, and generating a PPS signal. More documentation here: https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/11_01_05_03/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW-PTP.html

    The CPTS can be used to generate a PPS output, but you need a way to know the CPTS counter value relative to your clock master. With Ethernet, that's easy - the CPTS inside the CPSW can just timestamp the ethernet packet when the packet arrives. But I am not clear on how you are finding your relative counter values with the setup that you have described.

    Regards,

    Nick

  • Hi Nick,

    Thanks for your reply. Just to clarify: we are developing a PTP time server that will use GNSS signals received from an antenna as the reference. Our plan is to first integrate the GNSS module (NMEA + PPS) to discipline the PHC via ts2phc, and later broadcast time at PTP-level. This integration -NMEA and PPS - has been the main challenge so far. I described the details in my previous message.

    We have ordered an AM62x board, but we wanted to make progress and evaluate options on the 3358 in the meantime, which is why I asked about the 3358 first. On AM62x, PPS can be connected to HW_TS_PUSH, as I understand from the prev. question that this thread related on. On AM3358, we see a similar pin (Timer4 capture) is there any difference we should be aware of between the two?

    More importantly, could you advise us on how to approach this integration process on AM62x? What is the recommended way for a PTP master to get time data from GNSS to use it with ts2phc? 

    Thanks a lot for any guidance!

    Best regards,
    Veysel Eraslan