Skip to content

Commit a1ce697

Browse files
authored
PTP: fix ESP32-P4 hardware TX timestamp pair count
Fix the ESP-IDF hardware-timestamped transmit contract in both active PTP paths. LAB_SOURCE and TIME_RECEIVER now pass one buffer/length pair for one Ethernet frame, preventing the variadic EMAC transmit path from reading a nonexistent second pair. The stale pre-P2 SV timing experiment was not reintroduced; all exact-head workflows and review threads were clean before merge.
1 parent ad14f3a commit a1ce697

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎embedded/esp32p4_smv_injector/main/ptp_lab_task.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,12 @@ void seed_hardware_clock(const esp_eth_handle_t eth_handle) noexcept {
313313
PtpTimestamp& timestamp) noexcept {
314314
if (frame.empty()) return false;
315315
eth_mac_time_t tx_timestamp{};
316+
// esp_eth_transmit_ctrl_vargs argc counts buffer/length pairs. One PTP
317+
// Ethernet frame is exactly one pair.
316318
const auto result = esp_eth_transmit_ctrl_vargs(
317319
eth_handle,
318320
&tx_timestamp,
319-
2U,
321+
1U,
320322
frame.data(),
321323
frame.size());
322324
if (result != ESP_OK || !valid_hw_timestamp(tx_timestamp)) {

‎embedded/esp32p4_smv_injector/main/ptp_receiver_task.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,12 @@ void seed_hardware_clock(const esp_eth_handle_t handle) noexcept {
176176
PtpTimestamp& timestamp) noexcept {
177177
if (frame.empty()) return false;
178178
eth_mac_time_t tx_timestamp{};
179+
// esp_eth_transmit_ctrl_vargs argc counts buffer/length pairs. One PTP
180+
// Ethernet frame is exactly one pair.
179181
const auto result = esp_eth_transmit_ctrl_vargs(
180182
handle,
181183
&tx_timestamp,
182-
2U,
184+
1U,
183185
frame.data(),
184186
frame.size());
185187
if (result != ESP_OK || !valid_hw_timestamp(tx_timestamp)) return false;

0 commit comments

Comments
 (0)