Skip to content

WRONG ptpTimescale flag from ptp4l #51

@KilledByBugs

Description

@KilledByBugs

Hi,

I was trying ptp4l on my NXP i.MX boards. Then, I tried PMC settings on my ptp4l (using the steps on the following page https://tsn.readthedocs.io/avb.html )

What I have done to set up the time sync and PMC previously:

  1. start ptp4l : ptp4l -m -i eth0 -f automotive-master_domain0.cfg --step_threshold=1 &

PS: The content of "automotive-master_domain0.cfg" file is:

[global]
# Options carried over from gPTP.
gmCapable               1
priority1               248
priority2               248
logSyncInterval         -3
syncReceiptTimeout      3
neighborPropDelayThresh 800
min_neighbor_prop_delay -20000000
assume_two_step         1
path_trace_enabled      1
follow_up_info          1
transportSpecific       0x1
ptp_dst_mac             01:80:C2:00:00:0E
network_transport       L2
delay_mechanism         P2P
domainNumber            0

#
# Automotive Profile specific options
#
BMCA                    noop
masterOnly              1
  1. To set the system clocks (CLOCK_REALTIME and CLOCK_TAI), configure the UTC-TAI offset in the system:
pmc -u -b 0 -t 1 "SET GRANDMASTER_SETTINGS_NP clockClass 248 \

clockAccuracy 0xfe offsetScaledLogVariance 0xffff \

currentUtcOffset 37 leap61 0 leap59 0 currentUtcOffsetValid 1 \

ptpTimescale 1 timeTraceable 1 frequencyTraceable 0 \

timeSource 0xa0"
  1. To check if the setting is successful:
    pmc -u -b 0 -t 1 "GET GRANDMASTER_SETTINGS_NP"

the output is:

sending: GET GRANDMASTER_SETTINGS_NP
484952.fffe.411081-0 seq 0 RESPONSE MANAGEMENT GRANDMASTER_SETTINGS_NP
clockClass 248
clockAccuracy 0xfe
offsetScaledLogVariance 0xffff
currentUtcOffset 37
leap61 0
leap59 0
currentUtcOffsetValid 1
ptpTimescale 1
timeTraceable 1
frequencyTraceable 0
timeSource 0xa0

It seems good. That is the setting I want.

  1. start phc2sys
    phc2sys -c eth0 -s CLOCK_REALTIME --step_threshold=1 --transportSpecific=1 -w &

After that, I checked the message captured from eth0. The message sent on ethernet was WRONG. The flags such as ptpTimescale are false which is different to the PMC settings. (The following picture is the message read by Wireshark.)
Screenshot from 2024-07-30 14-38-31
Screenshot from 2024-07-30 14-38-25
The message package captured by tcpdump is in the attachment file:
logAfterPhc2sys.zip

I also ran the 'check_clocks' to check the time sync. The output was:

phc-tai delta is greater than 50 usec !
TAI offset set in kernel is not correct !
Please verify ptp4l and phc config and restart them if necessary to synchronize the clocks !

What I have tried to solve the problem:

  1. disable NTP: timedatectl set-ntp false and then restart ptp4l
  2. make sure there is only one ptp4l, one phc2sys running: ps -A | grep ptp4l (there is only 1 ptp4l、 phc2sys)
    However, those don't solve the problem.

My questions:

  1. Can you suggest why the PMC setting doesn't work on the actual message sent from ptp4l?
  2. Is there any other thing that can affect the PMC setting I need to avoid?
  3. Can you let me know how to solve the problem? (correct PMC setting, but WRONG flags on message)

Kind Regards,
Jim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions