ESP-NOW timestamp relation to TSF?

robiwan
Posts: 29
Joined: Sat Dec 07, 2024 11:36 am

ESP-NOW timestamp relation to TSF?

Postby robiwan » Sat Jan 18, 2025 7:13 pm

The ESP-NOW timestamp in the esp_now_recv_info struct is 32 bit (usec resolution). How is this timestamp related to the TSF counter of the WiFi interface?

ESP-NOW comes without any sources so there's no way to check how the timestamp is acquired.

I need to be able to create a timestamp in the same manner, for implementing PTP.

ahsrabrifat
Posts: 23
Joined: Sat Jan 18, 2025 2:31 pm

Re: ESP-NOW timestamp relation to TSF?

Postby ahsrabrifat » Sun Jan 19, 2025 3:06 pm

You can use the esp_timer_get_time() function to approximate a timestamp.

robiwan
Posts: 29
Joined: Sat Dec 07, 2024 11:36 am

Re: ESP-NOW timestamp relation to TSF?

Postby robiwan » Mon Jan 20, 2025 7:01 am

Already tried that, and it doesn't cut it. I need the *same* timer as that used for the wifi_pkt_rx_ctrl_t.timestamp field, or a similar APB based timer within microseconds.

robiwan
Posts: 29
Joined: Sat Dec 07, 2024 11:36 am

Re: ESP-NOW timestamp relation to TSF?

Postby robiwan » Sun Jan 26, 2025 11:27 am

Using the WiFi promiscuous callback (for beacon/probe) I can see that the relation between the TSF and the rx_ctrl.timestamp is very stable, so with that, I can deduce a difference between those and then use the TSF value to start a secondary (APB based) usec timer which has (very close to) the same value as the timestamp counter.

Who is online

Users browsing this forum: No registered users and 105 guests