Step 3.3a: PTP servo, clock locks to the GM
- ptp_hw: ptp_hw_adj_freq() (ETH_MAC_ESP_CMD_ADJ_PTP_TIME, absolute ppb vs nominal, clamped +-500 ppm, retried while the addend update is busy) and ptp_hw_step() (read + write time). - ptp_clock: first Sync after a GM is selected seeds the integral with the measured rate and steps the clock; then linuxptp-style PI (kp/ki from the Sync interval: 0.7/0.3 at 1 s). Re-step above 1 ms. Locked after 8 Syncs with |offset| < 1 us, unlocked after 3 above; GM change or loss unlocks and keeps the frequency (holdover). - Verified vs ptp4l: stepped to GM time, locked after ~19 s; locked offset within +-510 ns (mostly < 300 ns), correction +39.9 ppm (crystal -39.8 ppm), path delay ~10.2 us. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,10 @@ esp_err_t ptp_hw_init(esp_eth_handle_t eth, esp_netif_t *netif);
|
||||
// sequence ID and sourcePortIdentity (10 bytes). Each record is returned once.
|
||||
bool ptp_hw_rx_ts(uint8_t msg_type, uint16_t seq, const uint8_t *src_port_id, eth_mac_time_t *ts);
|
||||
esp_err_t ptp_hw_get_time(eth_mac_time_t *t);
|
||||
// Frequency correction relative to the nominal rate, in ppb (positive = faster).
|
||||
esp_err_t ptp_hw_adj_freq(double ppb);
|
||||
// Step the clock back by offset_ns (offset = local - GM), via read + write.
|
||||
esp_err_t ptp_hw_step(int64_t offset_ns);
|
||||
// Send a PTP event message as a raw Ethernet/IPv4/UDP frame (port 319 -> 319) and return its
|
||||
// hardware TX timestamp. dst_ip/dst_mac: 224.0.1.129 / 01:00:5e:00:01:81 or the GM unicast.
|
||||
esp_err_t ptp_hw_send_event(const uint8_t dst_mac[6], uint32_t dst_ip, uint8_t dscp,
|
||||
|
||||
Reference in New Issue
Block a user