Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement Precision Time Protocol (PTP) on Rpi4? #6

Open
lineker10 opened this issue Oct 1, 2019 · 12 comments
Open

How to implement Precision Time Protocol (PTP) on Rpi4? #6

lineker10 opened this issue Oct 1, 2019 · 12 comments

Comments

@lineker10
Copy link

I used Precision Time Protocol (PTP)/IEEE-1588 on Raspberry pi3b+ by linuxptp refereed this site. Recently, I upgraded to Raspberry pi 4 and I try to use PTP on Raspberry pi 4. Unfortunately, I cannot use it on raspberry pi 4. Because, I don't see SOF_TIMESTAMPING_TX_SOFTWARE listed.
If anybody knows the solution of it, please answer my problem.

@fortrieb
Copy link

Hi @lineker10 ,

there is a Kernel 5.x at Raspberry Pi kernel repository (https://github.com/raspberrypi/linux/tree/rpi-5.3.y). I get PTP working on Raspberry Pi 4 with this kernel and following official documentation on compiling custom kernel (https://www.raspberrypi.org/documentation/linux/kernel/building.md).

Adding mentioned configuration option here after make bcm2711_defconfig and continue compiling.

@lineker10
Copy link
Author

Hi @fortrieb
Thank you very much. I will try your advice.

@mikebrady
Copy link

Thanks @lineker10. I was able to get software timestamping on the ethernet port with your hint.

pi@raspberryPi4B:~ $ uname -a
Linux raspberryPi4B 5.3.18-v7l+ #1 SMP Wed Jan 8 09:57:24 GMT 2020 armv7l GNU/Linux
pi@raspberryPi4B:~ $ sudo ethtool -T eth0
Time stamping parameters for eth0:
Capabilities:
	software-transmit     (SOF_TIMESTAMPING_TX_SOFTWARE)
	software-receive      (SOF_TIMESTAMPING_RX_SOFTWARE)
	software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes: none
Hardware Receive Filter Modes: none
pi@raspberryPi4B:~ $ sudo ethtool -T wlan0
Time stamping parameters for wlan0:
Capabilities:
	software-receive      (SOF_TIMESTAMPING_RX_SOFTWARE)
	software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes: none
Hardware Receive Filter Modes: none
pi@raspberryPi4B:~ $ 

@lineker10
Copy link
Author

Thank you @mikebrady
I try to run by your help...

@yobertyosua

This comment has been minimized.

@yobertyosua

This comment has been minimized.

@yobertyosua
Copy link

I have a question again.
I wanna try to install PTP on my RaspPi 4, but for another Kernel (4.19.y-rt). I did the step https://github.com/twteamware/raspberrypi-ptp for the current Kernel and it works. But if I try to do the same steps but into Kernel 4.19.y-rt, it didnt work. Is PTP not support Kernel 4.19.y-rt?

Thanks before

@gizero
Copy link
Contributor

gizero commented Jan 19, 2021

What exactly "didn't work"? where did you get your kernel 4.19.y-rt from?

@yobertyosua
Copy link

yobertyosua commented Jan 19, 2021

Thanks for the response.
So, here are what i got:

where did you get your kernel 4.19.y-rt from?

I got it from https://github.com/raspberrypi/linux/tree/rpi-4.19.y-rt. I typed git clone https://github.com/raspberrypi/linux.git -b rpi-4.19.y-rt on my terminal to get the kernel 4.19.y.rt.
Here is the picture of my actual kernel:
kernel

What exactly "didn't work"?

SOF_TIMESTAMPING_TX_SOFTWARE is missing after i rebooted the kernel 4.19.y-rt. I noticed it after i checked it using ethtool -T eth0

missing tx

Correct me if I'm wrong. I think the answer is https://github.com/twteamware/raspberrypi-ptp/blob/master/kernel-patching.md. And I should patch https://github.com/twteamware/raspberrypi-ptp/blob/master/patches/0001-smsc95xx-use-generic-ethtool_op_get_ts_info-callback.patch using patch
Should I put that patch file in the same folder, where my linux kernel is?

Actually I dont understand how to patch. I just did this:
patch
Can you please help me to understand it?
I already read https://github.com/twteamware/raspberrypi-ptp/issues/3, but it still doesnt help me to understand, how to patch it.

Sorry if I ask too much

@michael-gosselin
Copy link

michael-gosselin commented Dec 9, 2022

there is a Kernel 5.x at Raspberry Pi kernel repository (https://github.com/raspberrypi/linux/tree/rpi-5.3.y)

@fortrieb thanks for this, super helpful. Does it have to be kernel 5.3.y ? I tried this with a newer kernel (5.15.y) and it didn't work:

$ sudo ethtool -T eth0

gives:

Time stamping parameters for eth0:
Capabilities:
	software-transmit
	software-receive
	software-system-clock
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes: none
Hardware Receive Filter Modes: none

I also notice that ptp4l is not running after I boot:

$ sudo systemctl status ptp4l

gives,

Unit ptp4l.service could not be found.

I am using a raspberry pi 4B.

@fortrieb
Copy link

Hi @michael-gosselin, i didn't try a newer kernel then 5.3.y.

@Grisly00
Copy link

@michael-gosselin Similarly I am using a new Kernel (5.15.0-1024-raspi) with a RPI4 and I have the exact same issue as you with ethtool not showing support and ptp4l.service not found.
Did you manage to find a workaround?
According to the readme (https://github.com/twteamware/raspberrypi-ptp#enable-software-timestamping-in-ptp4l-configuration) it should be enough to enable software support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants