cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure PTP PPS out?

GLaure
Senior

Hi!

 

I am trying to enable PTP on STM32F157 DK2 evaluation board.

 

From my understanding, pps_available should return 1, (if configured correctly).

 

root@stm32mp1:~# cat /sys/class/ptp/ptp0/pps_available 
0

I added "linuxptp" to the image:

IMAGE_INSTALL_append += " \
    linuxptp \
    "

I tried to follow the instructions for kernel 4.14:

https://community.st.com/s/question/0D50X0000BMG2RoSQL/how-do-i-enable-linuxptp-pps-output

 

To enable PPS Out, I also patched stm32mp-mp15-pinctrl.dtsi

diff --git a/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi b/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi
index 236d77e..1e74905 100644
--- a/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi
@@ -160,6 +160,7 @@
 	ethernet0_rgmii_pins_a: rgmii-0 {
 		pins1 {
 			pinmux = <STM32_PINMUX('G', 5, AF11)>, /* ETH_RGMII_CLK125 */
+				 <STM32_PINMUX('G', 8, AF11)>, /* ETH_PPS_OUT */
 				 <STM32_PINMUX('G', 4, AF11)>, /* ETH_RGMII_GTX_CLK */
 				 <STM32_PINMUX('G', 13, AF11)>, /* ETH_RGMII_TXD0 */
 				 <STM32_PINMUX('G', 14, AF11)>, /* ETH_RGMII_TXD1 */
@@ -191,6 +192,7 @@
 	ethernet0_rgmii_sleep_pins_a: rgmii-sleep-0 {
 		pins1 {
 			pinmux = <STM32_PINMUX('G', 5, ANALOG)>, /* ETH_RGMII_CLK125 */
+				 <STM32_PINMUX('G', 8, ANALOG)>, /* ETH_PPS_OUT */
 				 <STM32_PINMUX('G', 4, ANALOG)>, /* ETH_RGMII_GTX_CLK */
 				 <STM32_PINMUX('G', 13, ANALOG)>, /* ETH_RGMII_TXD0 */
 				 <STM32_PINMUX('G', 14, ANALOG)>, /* ETH_RGMII_TXD1 */
-- 
2.25.1

 

As far as I could see, the other changes are not longer needed for kernel 5.10.

 

Still cat /sys/class/ptp/ptp0/pps_available returns 0.

 

What did I miss?

 

Any help is greatly appreciated!

 

Have a nice weekend!

 

Gunther

10 REPLIES 10
GLaure
Senior

Good Morning @OlivierK​ ,

PTP was on hold as I had to get DMA from an FPGA running. This is working now, so will look into PTP again. I will report back 🙂

Update:

I used this kernel config fragment:

CONFIG_PPS=y
CONFIG_PPS_DEBUG=y
#
# PPS clients support
#
CONFIG_PPS_CLIENT_KTIMER=m
CONFIG_PPS_CLIENT_LDISC=m
CONFIG_PPS_CLIENT_GPIO=m

The CONFIG_PPS_CLIENT_KTIMER has to be configured as a module. If it is buildin (with 'y') pps0 as device is not created.

Then start ptp4l as you described:

ptp4l -l 6 -m -i eth0 -p /dev/ptp0

and set the pps duty cycle

echo "0 0 0 1 1" > /sys/class/ptp/ptp0/period

A oszilloscpe now shows the PPS!

Perfect and thank you @OlivierK​ 

Update 2:

Just to be complete:

This is not necessary:

modprobe pps-ktimer
  1. You have to patch the PPS out pin in the device tree (PG8 in my case)
  2. CONFIG_PPS=y my be necessary
  3. You have to run pp4l
  4. You have to configure /sys/class/ptp/ptp0/period

Bye, Gunther