jclark / rpi-cm4-ptp-guide

Guide to using the hardware PTP support in the Raspberry Pi CM4
MIT License
83 stars 10 forks source link

CM4 SYNC_OUT does not have any signal output #36

Open qqzg opened 4 months ago

qqzg commented 4 months ago

I want to measure the pps accuracy of the output from phc. I follow the steps below. sudo ./testptp -d /dev/ptp0 -L 0,2 sudo ./testptp -d /dev/ptp0 -p 1000000000 -w 1000

But SYNC_OUT does not have any signal output. I used an oscilloscope to measure J2 PIN9.

SYNC OUT PIN can be used as input to receive PPS signals. Referring to my following steps, you can see that PHC has received PPS events root@raspberrypi:/home/falcon# ./testptp -d /dev/ptp0 -L 0,1 0,1 set pin function okay

root@raspberrypi:/home/falcon# ./testptp -e 5 external time stamp request okay event index 0 at 124.523073480 event index 0 at 125.523075280 event index 0 at 126.523077072 event index 0 at 127.523078872 event index 0 at 128.523080640

jclark,do you have any idea, thanks,I am looking forward to your answer very much

JN19aban commented 4 months ago

On what version of Raspbian are you testing?

The positive of oscilloscope should be on J2 pin and the ground on pin 39 (GPIO) or whatever free ground pin available.

qqzg commented 4 months ago

On what version of Raspbian are you testing?

The positive of oscilloscope should be on J2 pin and the ground on pin 39 (GPIO) or whatever free ground pin available.

Raspbian version: I use the latest kernel code on the branch rpi-6.6.y, and confirm that the bcm-phy-ptp.c file has the pps feature.

The positive pole of the oscilloscope is connected to PIN9 on J2, and the negative pole is connected to the ground.

jclark commented 4 months ago

The pulse width is very short (you specified 1 microsecond), so you may need to adjust your oscilloscope settings for it to detect the pulse.

qqzg commented 4 months ago

The pulse width is very short (you specified 1 microsecond), so you may need to adjust your oscillator settings for it to detect the pulse.

jclark, Thanks very much for your reply

I tested in the following way and configured GPIO16 as the PPS pin input to receive the SYNC_OUT signal(Connect the GPIO 16 and SYNC OUT pins directly ), but still couldn't receive the PPS signal from SYNC_OUT,As follows:

root@raspberrypi:/home/falcon# ./testptp -d /dev/ptp0 -L 0,2
0,2
set pin function okay

root@raspberrypi:/home/falcon# ./testptp -d /dev/ptp0 -p 1000000000 -w 4000
periodic output request okay

root@raspberrypi:/home/falcon# ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)

GPS pps pulse signals can be received through the PPS input pin, as shown below

root@raspberrypi:/home/falcon# ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1717342902.788809567, sequence: 10929 - clear  0.000000000, sequence: 0
source 0 - assert 1717342903.788824585, sequence: 10930 - clear  0.000000000, sequence: 0
source 0 - assert 1717342904.788842232, sequence: 10931 - clear  0.000000000, sequence: 0
source 0 - assert 1717342905.788861676, sequence: 10932 - clear  0.000000000, sequence: 0
source 0 - assert 1717342906.788875453, sequence: 10933 - clear  0.000000000, sequence: 0
source 0 - assert 1717342907.788896212, sequence: 10934 - clear  0.000000000, sequence: 0
qqzg commented 4 months ago

The pulse width is very short (you specified 1 microsecond), so you may need to adjust your oscillator settings for it to detect the pulse.

jclark, Thanks very much for your reply

I tested in the following way and configured GPIO16 as the PPS pin input to receive the SYNC_OUT signal(Connect the GPIO 16 and SYNC OUT pins directly ), but still couldn't receive the PPS signal from SYNC_OUT,As follows:

root@raspberrypi:/home/falcon# ./testptp -d /dev/ptp0 -L 0,2
0,2
set pin function okay

root@raspberrypi:/home/falcon# ./testptp -d /dev/ptp0 -p 1000000000 -w 4000
periodic output request okay

root@raspberrypi:/home/falcon# ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)

GPS pps pulse signals can be received through the PPS input pin, as shown below

root@raspberrypi:/home/falcon# ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1717342902.788809567, sequence: 10929 - clear  0.000000000, sequence: 0
source 0 - assert 1717342903.788824585, sequence: 10930 - clear  0.000000000, sequence: 0
source 0 - assert 1717342904.788842232, sequence: 10931 - clear  0.000000000, sequence: 0
source 0 - assert 1717342905.788861676, sequence: 10932 - clear  0.000000000, sequence: 0
source 0 - assert 1717342906.788875453, sequence: 10933 - clear  0.000000000, sequence: 0
source 0 - assert 1717342907.788896212, sequence: 10934 - clear  0.000000000, sequence: 0

As shown in the figure below, I found that during the process, GPO16 can occasionally receive a SYNC_OUT PPS signal image