This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM625: Timestampe externel events via CPTS

Part Number: AM625

Tool/software:

Hello,

I want to timestamp an event with specific frequency using the HW-TS-Push functionality of the CPTS module.

For this I used the pin CP_GEMAC_CPTS0_HW1TSPUSH of the TSR as input (INPUT 12 by TSR), which then routes the signal to the CPTS-HW1-TS-Push of the CPTS (OUPUT 10 by TSR)

All pin muxing configurations are done properly in the respective DTS.

However, I can't measure any input event using the testptp tool.

What could I have done wrong?

BR

Zain

  • Hello Zain,

    Please provide additional information.

    1) What version of Linux SDK are you using?

    2) What changes did you make to the DTS files?

    3) which pin / header are you attaching your input signal to?

    4) How are you running tests from the software side?

    At this point, I have not used testptp for general timestamping. Off the top of my head, I am not sure if it can be used in that way, or if it is specific to Ethernet PTP communication.

    Regards,

    Nick

  • Hello Nick,

    • Version 09.02.01.10
    • I added this to the DTS:
      • &timesync_router {
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&cpsw_cpts>;
        
                cpsw_cpts: cpsw-cpts {
                        pinctrl-single,pins = <
                                     .
                                     .
                                     .
                                /* TS Push Pin [CP_GEMAC_CPTS0_HW1TSPUSH] in12 -> out12 [cpsw cpts hw1_push] */
                                K3_TS_OFFSET(10, 12)
                                >;
                };
        };
        
        
      • &main_pmx0 {
                
                .
                .
                .
                cpsw3g1_pins_default: cpsw3g1-default-pins {
                        pinctrl-single,pins = <
                                AM62X_IOPAD(0x01c0, PIN_INPUT, 1) /* (B13) SPI0_D0.CP_GEMAC_CPTS0_HW1TSPUSH */
                        >;
                };
        
        
        
        };
        
    • I use the Synphony Board from Variscite. I used the J10. First i disbaled the spi interface for the resestive touch because i use the same CP_GEMAC_CPTS0_HW1TSPUSH pin and i don't use it at all.
      • &main_spi0 {
                status = "disable";
                pinctrl-names = "default";
                pinctrl-0 = <&main_spi0_pins_default>;
                ti,pindir-d0-out-d1-in = <1>;
        
                ads7846@0 {
        
                        status = "disable";
                };
        };
        
        
    • I run testes using testptp tool with the following command;
      •     testptp -d /dev/ptp0 -e 10 -i 2   
        

    Of course testptp is specific to PTP. I have the ptp0 interface allready and it works fine.

    Do you any another tools to measure timestamping?

    BR

    Zain

  • Hello Zain,

    Good question. I do not see any kernel drivers that make use of CPTS for timestamping outside of drivers/net/ethernet/ti. Give me a couple of days to ask around to see if there is any preexisting code that I am unaware of.

    Can you tell me a bit more about your usecase?

    We do support using ECAP to capture timestamps for sure. So that might be an easier solution for your usecase. See this thread for more:
    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1242640/am625-ecap/4766153#4766153

    Regards,

    Nick

  • Hi Nick,

    do you have any new info?

    In /sys/class/ptp/ptp0 i can'nt enable extts_enable. I get the following error:

    root@am62x-var-som:~# echo 1 > /sys/class/ptp/ptp0/extts_enable 
    -bash: echo: write error: Invalid argument
    
    root@am62x-var-som:/sys/class/ptp/ptp0# cat extts_enable 
    cat: extts_enable: Permission denied

  • Hello Nick,

    I would like to use the HW-TS feature in CPTS to timestamp an external frequency. I have already successfully implemented eCAP, but discovered that timestamps only refer to a 32-bit counter. Therefore, the input event is timestamped based on the counter value and not, as with cpts, based on the system time. Of course, I can measure the current time for each timestamp. I don't want to do that because cpts's HW TS does it automatically and much more accurately than eCAP.

  • Hello Zain,

    I have not played around with the extts_enable feature yet. It looks like you need to write the channel index, followed by a "1" to enable timestamps from that channel: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-ptp

    Ok, so... what is each channel?

    Looks like entry n_external_timestamps tells us how many external timestamp channels are offered. Off the top of my head I am not sure exactly how many channels there are, and how they map to the CPTS inputs. But hopefully with a bit of trial and error we can figure out if there is a channel associated with HWxTSPUSH.

    Regards,

    Nick