All Projects → twteamware → raspberrypi-ptp

twteamware / raspberrypi-ptp

Licence: other
How to run IEEE-1588 on RaspberryPi hardware

Projects that are alternatives of or similar to raspberrypi-ptp

Berrylan
Raspberry Pi WiFi setup
Stars: ✭ 243 (+326.32%)
Mutual labels:  raspbian
clusterhat-image
Converts Raspbian/Raspberry Pi OS images to support Cluster HAT
Stars: ✭ 71 (+24.56%)
Mutual labels:  raspbian
scarecrow
A Raspberry Pi powered, distributed (edge) computing camera setups that runs a Tensorflow object detection model to determine whether a person is on the camera. A plugin model allows actions based on the detection, such as playing audio, turning on lights, or triggering an Arduino.
Stars: ✭ 87 (+52.63%)
Mutual labels:  raspbian
pihut-xmas-asyncio
Demonstration driving The Pi Hut Raspberry Pi 3D Xmas tree using Python Asyncio
Stars: ✭ 15 (-73.68%)
Mutual labels:  raspbian
raspbian10-buster
Raspbian 10 (Buster) Lite Setup: with Wireguard, Pi-hole, Unbound
Stars: ✭ 54 (-5.26%)
Mutual labels:  raspbian
TensorFlow-Raspberry-Pi
TensorFlow installation wheels for Raspberry Pi 32-bit OS
Stars: ✭ 18 (-68.42%)
Mutual labels:  raspbian
Pi Timelapse
Time-lapse app for Raspberry Pi computers.
Stars: ✭ 220 (+285.96%)
Mutual labels:  raspbian
wor-flasher
Legal utility that runs on RPiOS to flash another SD card with Windows 10/11
Stars: ✭ 451 (+691.23%)
Mutual labels:  raspbian
Bazel bin
Bazel's pre-built binaries for armv7l / aarch64 / x86_64.
Stars: ✭ 23 (-59.65%)
Mutual labels:  raspbian
ansible-role-raspberry-pi
Configures a Raspberry Pi (running Raspbian).
Stars: ✭ 90 (+57.89%)
Mutual labels:  raspbian
pi-top-setup
Using Raspbian Buster and Raspbian Stretch on the pi-top
Stars: ✭ 45 (-21.05%)
Mutual labels:  raspbian
fresh-coffee-listener
Using a raspberry pi, we listen to the coffee machine and count the number of coffee consumption
Stars: ✭ 52 (-8.77%)
Mutual labels:  raspbian
pidp11-2.11bsd
Using the historical unix 2.11 BSD operating system on the PiDP-11. With examples such as cool-retro-weatherstation.
Stars: ✭ 57 (+0%)
Mutual labels:  raspbian
Cattlepi
effortlessly boot, configure, update and monitor your raspberry pi ☁️
Stars: ✭ 250 (+338.6%)
Mutual labels:  raspbian
balena-chromium-kiosk
BalenaOS/BalenaCloud based Kiosk using Chromium on a RaspberryPi
Stars: ✭ 46 (-19.3%)
Mutual labels:  raspbian
Pivccu
piVCCU is a project to install the original Homematic CCU2 firmware inside a virtualized container (lxc) on ARM based single board computers.
Stars: ✭ 230 (+303.51%)
Mutual labels:  raspbian
Argon40-ArgonOne-Script
Script for the Argon ONE (V2) Pi 4 Raspberry Pi Case
Stars: ✭ 125 (+119.3%)
Mutual labels:  raspbian
raspberrypi-rstudio
RStudio for Raspberry Pi - Docker Build and Runtime Environment
Stars: ✭ 57 (+0%)
Mutual labels:  raspbian
ansible-raspbian
Ansible role for setting up a secure basic Raspbian environment with sensible defaults.
Stars: ✭ 54 (-5.26%)
Mutual labels:  raspbian
PiBootstrapper
Windows app to configure Raspbian SD card image before first boot
Stars: ✭ 40 (-29.82%)
Mutual labels:  raspbian

PTP on Raspberrypi3 with Raspbian

This guide explains how to enable support for Precision Time Protocol (PTP) to a Raspberrypi3 running the Raspbian operating system.

This notes were tested with Raspbian Stretch Lite (2018-10-09), running kernel 4.14.71. The following type of tasks are required to have a working PTP client on the Raspberry:

  • linux kernel must be configured, built and deployed to the target
  • additional packages must be installed and configured

Preliminary operations

  • Download Raspbian
  • flash it on an SD card
  • boot the OS

The following commands should be run from a terminal on the RaspberryPi target: a local or SSH connection for the Raspbian default user pi is assumed from now on. Note that SSH server is not enabled by default on Raspbian distribution.

(optionally) upgrade the distribution

sudo apt update
sudo apt upgrade

Install ptp related packages

sudo apt update
sudo apt install ethtool linuxptp

Enable software timestamping in ptp4l configuration

Raspberry Pi ethernet phy does not support hardware timestamping: hence software emulation must be enabled in ptp4l configuration. It can be done by patching ptp4l configuration file as follows:

sed -i -e 's/time_stamping.*$/time_stamping\t\tsoftware/' /etc/linuxptp/ptp4l.conf

Less recent kernels required patching the ethernet driver to overcome a limitation with frame timestamping. With those kernels, ptp4l fails to start while complaining for missing support for timestamping. If you are running older kernels, please either consider upgrading or see here for instructions on patching the kernel and fix the timestamping feature.

Build a new kernel with PTP support enabled

In order to build the kernel with required patches and configuration options, kernel sources must be fetched and some required build tools must be installed.

git clone --depth=1 https://github.com/raspberrypi/linux
sudo apt install git bc libncurses5-dev
cd linux
KERNEL=kernel7
make bcm2709_defconfig
make -j4 zImage modules dtbs

This will build the kernel in its default configuration and will take a long time. If anything fails, up to here please see the kernel building raspberrypi.org official page.

Apply required configuration changes

Some extra configuration options must be applied to the default bcm2709_defconfig. This can be done as follows. Run these commands from within the linux kernel sources directory.

echo 'CONFIG_NETWORK_PHY_TIMESTAMPING=y' >> .config
echo 'CONFIG_PTP_1588_CLOCK=y' >> .config

The above commands work if you already built the default kernel before applying the pathes. Otherwise you can enable them manually with any default kernel configuration target like make menuconfig.

Build kernel with PTP enabling changes

It is now possible to build the kernel with the changes we made to support PTP:

make olddefconfig
make -j4 zImage modules dtbs

The new kernel image, modules and dtbs must be installed over the current ones. Backing up current files is suggested in case something goes wrong and you want to rollback.

sudo make modules_install
sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img

The RaspberryPi is now ready to run ptp4l and can be rebooted for changes to take effect.

If you want to cross-compile the kernel on a faster host instead of running the process on the Raspberrypi itself, please refer to the general kernel cross-compile instruction here.

Troubleshooting

  • As mentioned above, you can use ethtool to verify that software Tx timestamping is available on the ethernet interface. The expected output of the command should be:
pi@raspberrypi:~ $ 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

If you don't see SOF_TIMESTAMPING_TX_SOFTWARE listed, you might be running an older kernel which requires patching the timestamping support (see kernel-patching.md).

  • ptp4l is automatically started as a systemd service at boot in Raspbian. You can inspect the service status with systemctl status ptp4l. If in the log the message failed to create a clock appears, it likely means the required kernel configuration bits were not enabled.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].