Add ptp4l usage

livox
2020-07-09 17:18:53 +08:00
parent 5756171fca
commit ece7a37814
3 changed files with 25 additions and 38 deletions
+25 -38
@@ -46,7 +46,7 @@ Connect Livox LiDAR/Hub normally without additional wiring.
### 2.1.2 Attention
Network environments with multiple master clocks are not supported. For the construction of master clock, please refer to Appendix [3.1 Set Up PTP Master Clock](#3.1).
Network environments with multiple master clocks are not supported. For the construction of master clock, please refer to Appendix [3.1 Set Up PTP Master Clock](#3.1 Set Up PTP Master Clock).
### 2.1.3 Accuracy
@@ -182,51 +182,38 @@ LiDAR_time_last = LiDAR_time;
## 3.1 Set Up PTP Master Clock
Address: [https://github.com/ptpd/ptpd](https://github.com/ptpd/ptpd)
Address: [http://linuxptp.sourceforge.net](http://linuxptp.sourceforge.net)
Download, compile and install:
```bash
git clone https://github.com/ptpd/ptpd.git
autoreconf -vi
./configure
git clone http://git.code.sf.net/p/linuxptp/code linuxptp
cd linuxptp
make
make install
sudo make install
```
Modify the configuration file client-e2e-socket.conf in the test folder according to your needs. You can use the following configuration:
Add a network interface name, such as eth0:
```
; Network interface to use (required)
ptpengine:interface = eth0
```
Set the master clock function and set the parameters to masteronly:
```
; Options: none slaveonly masteronly masterslave
ptpengine:preset = masteronly
```
Set clock_class to a value lower than 128:
```
; Clock class - announced in master state. Always 255 for slave-only mode.
; Minimum, maximum and default values are controlled by presets.
; If set to 13 (application specific time source), announced
; time scale is always set to ARB. This setting controls the
; states a PTP port can be in. If below 128, port will only
; be in MASTER or PASSIVE states (master only). If above 127,
; port will be in MASTER or SLAVE states.
ptpengine:clock_class = 126
```
Then run the following command:
In order to run this software, you need Linux kernel version 3.0 or newer. Check whether your network interface supports PTP with the following command(example, network interface is 'eth0').
```bash
ptpd2 -c test/client-e2e-socket.conf
ethtool -T eth0
```
When a sync packet appears on the network, it indicates that the master clock of ptpd is successfully turned on.
This command shows whether a MAC supports hardware or software time stamping.
The following example output indicates support for hardware time stamping.
![](./images/support.png)
The following example output indicates network interface not support for linuxptp/ptp4l, cannot be used.
![](./images/not_support.png)
If MAC supports hardware time stamping, then run the following command:
```bash
sudo ptp4l -i eth0 -l 6 -m
```
When a sync packet appears on the network, it indicates that the master clock of ptp4l is successfully turned on.
BIN
Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

BIN
Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB