[Linuxptp-users] LinuxPTP on Cyclone V SoC
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Arthur D. <art...@cy...> - 2018-10-17 19:44:27
|
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div> <div class="moz-text-html"> <div> <p><span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">Hello<br/> <br/> I am trying to add PTP support on a Cyclone V SoC using the HPS EMAC1, but have some problems making it work.<br/> The problems seem to be related to a wrong clock source to the PTP engine and/or device tree issues. I am using:<br/> - Linux kernel 4.1.22 ltsi RT (real time) w/patches<br/> - LinuxPTP 2.0</span></span></span></p> <p><span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">Steps taken:<br/> 1: Compiling and installing linuxptp 2.0<br/> 2: In Quartus Qsys: The “Enable EMAC1 precision Time Protocol (PTP) FPGA interface” box has been ticked, and this enables three PTP related signals:<br/> - emac_ptp_ref_clock: This clock has been routed through the FPGA to an IO pin on the development board, and is connected to an external clock source.<br/> - ptp_pps_o: Routed through the FPGA to an IO pin on the development board and is connected to a scope.<br/> - the trig signal is unused (connected to GND)<br/> 3: Updating the device tree:</span></span></span></p> <p><span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">gmac1: ethernet@ff702000 {<br/> ........<br/> clocks = <&emac1_clk &ext_clk_ptp_ref> ;<br/> clock-names = "stmmaceth", "clk_ptp_ref";<br/> .....<br/> }</span></span></span></p> <p><span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">Defining my external ptp clock source:<br/> ext_clk_ptp_ref: ext_clk_ptp_ref{<br/> compatible = "fixed-clock";<br/> #clock-cells = <0>;<br/> clock-frequency = <25000000>; /* 25.00 MHz */<br/> clock-output-names = "ext_clk_ptp_ref";<br/> };</span></span></span></p> <p><span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">4: Running a Yocto Krogoth distribution with various version of the linux kernel (4.18, 4.17, 4.9 ltsi-RT, and 4.1.22-ltsi-RT w/wo patches).</span></span></span></p> <p><span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">None of these kernel versions work as expected in my system.<br/> Kernel versions 4.17 and 4.18 do not seem to work at all, and </span></span></span><span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">I have ended up using version 4.1.22.ltsi-RT (real time) kernel with the patches recommended by "Hunter":</span></span></span><br/> <a class="m_8506162277458002053gmail-m_-3956338003932916256gmail-m_-4703061726690178958moz-txt-link-freetext" href="https://github.com/torvalds/linux/commit/19d857c9038e5c07db8f8cc02b5ad0cd0098714f" style="font-family: Verdana , sans-serif;font-size: 12.0px;" target="_blank"><font color="#0066cc">https://github.com/torvalds/linux/commit/19d857c9038e5c07db8f8cc02b5ad0cd0098714f</font></a><br/> ref "Adding LinuxPTP to Arria 10 SoC" email.</p> <p><span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">Output when running the "hwstamp_ctl -i eth0 -r 0 -t 1 " command:</span></span></span><br/> <span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;"> Device driver does not have support for non-destructive SIOCGHWTSTAMP.</span></span></span><br/> <span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;"> new settings:</span></span></span><br/> <span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;"> tx_type 1</span></span></span><br/> <span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;"> rx_filter 0</span></span></span><br/> <span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">With the </span></span></span><span style="display: inline;float: none;background-color: transparent;color: rgb(51,51,51);font-family: Verdana , sans-serif;font-size: 12.0px;font-style: normal;font-variant: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-decoration: none;text-indent: 0.0px;text-transform: none;white-space: normal;word-spacing: 0.0px;">4.1.22.ltsi-RT kernel and the command above </span><span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">I do get a 1PPS pulse each sec as long as my ext_clk_ptp_ref in the device tree is specified to be 25MHz.</span></span></span><br/> <span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">However, the actual frequency of this signal can be anything so the PTP engine does not seem to use my ext_clk_ptp_ref. </span></span></span><br/> </p> <p><span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">The "ptp4l -m -q -i eth0 ptp4l" command is not working:<br/> ptp4l[193.348]: selected /dev/ptp0 as PTP clock<br/> ptp4l[193.388]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE<br/> ptp4l[193.389]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE<br/> ptp4l[200.843]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES<br/> ptp4l[200.843]: selected local clock 70b3d5.fffe.761bc5 as best master<br/> ptp4l[200.843]: assuming the grand master role<br/> ptp4l[201.844]: timed out while polling for tx timestamp<br/> ptp4l[201.845]: increasing tx_timestamp_timeout may correct this issue, but it is likely caused by a driver bug<br/> ptp4l[201.845]: port 1: send sync failed<br/> ptp4l[201.845]: port 1: MASTER to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED)</span></span></span></p> <div><font color="#333333"><font face="Verdana, sans-serif"><span style="font-size: 12.0px;">I have tried with various clocks sources (external and from the HPS) and longer </span></font></font><span style="display: inline;float: none;background-color: transparent;color: rgb(51,51,51);font-family: Verdana , sans-serif;font-size: 12.0px;font-style: normal;font-variant: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-decoration: none;text-indent: 0.0px;text-transform: none;white-space: normal;word-spacing: 0.0px;">tx timestamp timeout setting</span><font color="#333333"><font face="Verdana, sans-serif"><span style="font-size: 12.0px;">, but without success.</span></font></font></div> <div> </div> <div><font color="#333333"><font face="Verdana, sans-serif"><span style="font-size: 12.0px;">Is there anyone who has managed to get this working on a Cyclone V SoC platform and can share some insight into how to connect the PTP signal in Qsys and necessary device tree mappings? </span></font></font></div> <p><br/> <span style="font-size: 12.0px;"><span style="color: rgb(51,51,51);"><span style="font-family: Verdana , sans-serif;">Thanks,<br/> AD</span></span></span></p> </div> </div> </div></div></body></html> |