Xinyuan-LilyGO / LilyGO-T-ETH-Series

162 stars 63 forks source link

T-ETH-Lite-S3 W5500 - Can it go faster? #74

Open troyhacks opened 1 month ago

troyhacks commented 1 month ago

I'm curious if there's any areas for speed improvement with the W5500 code?

My same code (obviously a different driver) running on a board with a LAN8720 has about a 3x increase in transfer speed (~10mbit on the W5500 vs ~30mbit on the LAN8720)

The T-ETH-Lite-S3 even transmits faster on its internal WiFi than using the onboard W5500 - although the W5500 is much more stable.

I am using -D ETH_PHY_SPI_FREQ_MHZ=60 which provides some benefit over the default 20MHz setting. (80Mhz does not work in my testing)

The W5500 code works great and is super stable - I was just surprised with the speed testing being so slow.

troyhacks commented 1 month ago

The code is sending Art-Net packets.

Here I start with the onboard WiFi and plug in the Ethernet:

UDP for 8064 pixels took 17614 micros. 25056 data in 48 total packets. 11.95 mbit/sec at 38 FPS.
UDP for 8064 pixels took 16085 micros. 25056 data in 48 total packets. 13.08 mbit/sec at 38 FPS.
UDP for 8064 pixels took 16754 micros. 25056 data in 48 total packets. 12.56 mbit/sec at 38 FPS.

Network Event: ARDUINO_EVENT_ETH_CONNECTED = ETH connected. Setting up ETH
Ethernet speed is 100 mbit and link is full duplex! (MAC: 36:85:18:8F:40:25)
Network Event: ARDUINO_EVENT_ETH_GOT_IP = ETH is up. Disabling WiFi

UDP for 8064 pixels took 19867 micros. 25056 data in 48 total packets. 10.59 mbit/sec at 34 FPS.
UDP for 8064 pixels took 19866 micros. 25056 data in 48 total packets. 10.59 mbit/sec at 34 FPS.
UDP for 8064 pixels took 19713 micros. 25056 data in 48 total packets. 10.67 mbit/sec at 34 FPS.

With the LAN8720 it's running at around 30 mbit/sec and my FPS is correspondingly much higher:

UDP for 8064 pixels took 6677 micros. 25056 data in 48 total packets. 31.55 mbit/sec at 57 FPS.
UDP for 8064 pixels took 6979 micros. 25056 data in 48 total packets. 30.16 mbit/sec at 57 FPS.
UDP for 8064 pixels took 6946 micros. 25056 data in 48 total packets. 30.31 mbit/sec at 57 FPS.

(FPS and transmit speed are not expected to be directly correlated, but it is worth noting the LED effect runs at a higher FPS with the LAN8720)

I'm hoping for a faster W5500 speed because the ESP32-S3 has some significant advantages for the work I'm doing - like their highly accelerated FFT routines, etc.

troyhacks commented 1 month ago

Recompiled arduino-esp32 with some optimizations and non-default options enabled for the ESP32-S3 and the W5500 bandwidth does improve:

UDP for 8064 pixels took 17118 micros. 25056 data in 48 total packets. 12.29 mbit/sec at 40 FPS.
UDP for 8064 pixels took 17087 micros. 25056 data in 48 total packets. 12.31 mbit/sec at 40 FPS.
UDP for 8064 pixels took 17102 micros. 25056 data in 48 total packets. 12.30 mbit/sec at 40 FPS.

Microseconds for 48 packets is down from ~19800 to ~17100 👍🏻

github-actions[bot] commented 1 week ago

This issue is stale because it has been open for 30 days with no activity.