esp-idf icon indicating copy to clipboard operation
esp-idf copied to clipboard

PTP can be support ESP32S3 (IDFGH-15040)

Open skylin008 opened this issue 8 months ago • 15 comments

Answers checklist.

  • [x] I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • [x] I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • [x] I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

Thank you shared this impressive project. I had notice the ptp can be support esp32p4, does it can be support other esp32 chip, for example esp32s3, esp32c6, esp32c3, so on. Thanks!

skylin008 avatar Apr 07 '25 01:04 skylin008

ESP-IDF currently only support the PTP at the MAC layer. And only ESP32-P4 has the EMAC controller which support IEEE1588v2.

suda-morris avatar Apr 07 '25 02:04 suda-morris

Thanks @suda-morris. How about PTP master accurately be run in esp32p4 eval board? What are the requirements about ETH PHY? IP101GRI be can support PTP master?

skylin008 avatar Apr 13 '25 06:04 skylin008

Duplicate of https://github.com/espressif/esp-idf/issues/1223 ?

Dominaezzz avatar Apr 13 '25 14:04 Dominaezzz

When I run ptp example , any error message shows, attach logs .

ptp.log

skylin008 avatar Apr 14 '25 02:04 skylin008

Any statistical method to measure PTP precision hasn't been performed yet but when I was testing the the PTP, it's mostly in 60ns (there are time to time peaks to ~100ns). This was measured by GPIO toggling from ISR. 40 MHz CLK was used as as PTP CLK reference. 80 MHz reference could be used too. However, I haven't tried yet. This option is currently not available for user space.

Regarding PHY, it's PHY independent since time stamping is performed in internal MAC.

When I run ptp example , any error message shows, attach logs .

What is your setup? errno 5 indicates I/O error. Is your link UP? Try to enable debug messages.

kostaond avatar Apr 14 '25 05:04 kostaond

Thanks @kostaond, It running default setup with esp32p4 eval board. what is ptp default ip setting?

skylin008 avatar Apr 14 '25 06:04 skylin008

Do you have two boards connected together? PTP messages are exchanged at IEEE 802.3 Ethernet (L2) layer only, i.e. no IP.

kostaond avatar Apr 14 '25 07:04 kostaond

Thanks every one! I want to used esp32p4 EVAL BOARD for ptp master, and lidar , camera connect to switch, attach figure. It used synchronize sensor and add time stamp for every data package.

Image

skylin008 avatar Apr 15 '25 02:04 skylin008

OK, that's certainly possible. Have you been able to resolve the I/O error in your setup? I tried locally and the PTP master sends sync message as expected. I tested on master branch.

kostaond avatar Apr 15 '25 06:04 kostaond

Thanks @kostaond, I had only one ESP32P4 EVAL board. If I can test PTP master to another slave device(for instance ubuntu host machine), the machine run linux ptp4l and phc2sys function.

skylin008 avatar Apr 16 '25 10:04 skylin008

And I want to add GPS module, it can provide the UTC time, then through the UART port , parse the GPS sentence to PTPT master

skylin008 avatar Apr 16 '25 10:04 skylin008

Thanks @kostaond, I had only one ESP32P4 EVAL board. If I can test PTP master to another slave device(for instance ubuntu host machine), the machine run linux ptp4l and phc2sys function.

If the link us UP, it should work. Only don't expect precise sync since it is really not common to PCs have hardware time stamp support.

kostaond avatar Apr 16 '25 11:04 kostaond

@kostaond Thanks. I had tested the PTP master via ubuntu machine,it has a hardware timestamp. ubuntu machine is slaveonly mode, it runs follow comad: sudo ptp4l -i enp0s31f6 -m -H -s . esp32p4 eval board show as logs only:

I (1312327) ptpd: Sent sync + follow-up, seq 1295

I (1313337) ptpd: Sent announce, seq 130

I (1313337) ptpd: Sent sync + follow-up, seq 1296

I (1314347) ptpd: Sent sync + follow-up, seq 1297

I (1315357) ptpd: Sent sync + follow-up, seq 1298

I (1316367) ptpd: Sent sync + follow-up, seq 1299

I (1317377) ptpd: Sent sync + follow-up, seq 1300

is it right?

skylin008 avatar Apr 29 '25 01:04 skylin008

Is there IEEE1588 PTP master function test example?

skylin008 avatar Jun 15 '25 03:06 skylin008

https://github.com/espressif/esp-idf/tree/master/examples/ethernet/ptp

kostaond avatar Jun 16 '25 06:06 kostaond

@skylin008, to be honest, I still don't see any real problem to be reported by this GH issue... If you want to just discuss or share your PTP related observations, please use our forum at www.esp32.com for that purpouse. Thank you for you understanding.

kostaond avatar Jul 02 '25 13:07 kostaond