Description
While using ESP32 with W5500 it sometimes sends malformed packet. Time periods between malformed packets differs significantly - from few seconds to couple of hours.
I've found this problem when using PubSubClient for MQTT where it caused client to be disconnected from MQTT broker.
To isolate the problem I've prepared very simple TCP server and I've been sending TCP messages to it with ESP32+W5500 in a single connection, continuously. It usually starts failing after few hours, then it breaks from time to time (sometimes within seconds, sometimes works for hours). I do not have this problem with ESP32 WiFi connection.
I've tried with another ESP32 and another W5500 with the same effect.
Please find Wireshark file with section of captured packages attached (packet number 15 is the problematic one).
raw_TCP_incorrect_incoming_packet.zip
Libraries with versions
- PlatformIO SDK for espressif32 v.1.7.0
- arduino-esp32 v.1.0.1 (not possible to use 1.0.2 because of Virtual functions in client.h are out of line with standard Arduino API espressif/arduino-esp32#2755)
- Ethernet v.2.0.0
Hardware used:
DOIT Esp32 DevKit v1
Wiznet W5500
Wiring between ESP32 and W5500
GPIO23 <--> MOSI
GPIO19 <--> MISO
GPIO18 <--> SCLK
GPIO5 <--> SCS
GPIO13 <--> RESET
Additional information
TCP server is set up in local network.
Simple implementation used to reproduce problem: https://github.com/maniekq/ESP32_W5500_TCP/blob/master/src/main.cpp#L73
Simple TCP server implementation: https://github.com/maniekq/servertcp-esp32