MQTT/TCP connection stability problem on Teensy 4.1 with W5500

Status
Not open for further replies.

mariuszjo

New member
I've got a problem with TCP connection stability on Teensy 4.1 and W5500.
I know it is possible to use native ethernet on the T4.1, but I have a few W5500 which I would like to use.

I need stable connection to MQTT broker, but it is failing from time to time and Teensy is not able to reconnect.
To rule out problems with MQTT library (PubSubClient) I've tested it with simple TCP connection. There is a simple TCP server and Teensy is writing to it every second.

Connection fails after some time. Sometimes it fails after 10 minutes, another time after 9 hours.
When it is running fine and I will reconnect ethernet cable or restart TCP server Teensy+W5500 reconnects just fine.

When the problem occurs itself, and Teensy is disconnected, it is trying to connect again without success. `Ethernet.linkStatus()` shows link is UP. If I'll try to ping Teensy after the connection failure - there is no response.
The only way to make it work again is to restart Teensy.

The output I got from Teensy serial:

Code:
[...]
Sending another batch of messages to TCP server. uptime = 2864
Sending another batch of messages to TCP server. uptime = 2865
Sending another batch of messages to TCP server. uptime = 2866
Sending another batch of messages to TCP server. uptime = 2867
Client disconnected...
Connecting to TCP server...
Connection failed. Reconnecting...
Link status: OFF
Connection failed. Reconnecting...
Link status: ON
Connection failed. Reconnecting...
Link status: ON


Does anyone use Teensy 4.1 with W5500 for long running TCP connection like MQTT? Am I doing something wrong?

Wiring between Teensy and W5500:
GPIO 10 <--> SCS
GPIO 11 <--> MOSI
GPIO 12 <--> MISO
GPIO 13 <--> SCLK
GPIO 2 <--> RESET
G <--> GND
3V <--> 3.3V

Teensy is connected to PC and powered through USB cable.

IMG_20200703_103042.jpg




This is the code I am using on Teensy.
And simple TCP server.
 
Is there anyone using Teensy 4.1 or Teensy 4.0 with W5500?
I would appreciate any information about your experience with stability of this set.
 
Status
Not open for further replies.
Back
Top