Ubuntu Version: 24.04
Problem Description:
Hi, I am new to the Ubuntu forums, but I am looking for some technical expertise on a problem I’ve been facing for a few days. I’m running a ROS2 node from a python script on a Rapsberry Pi 4 running Ubuntu. The purpose of the script is to communicate to a teensy microcontroller via TCP over ethernet. I have successfully done this, however I am facing a weird problem. Once I get a successful TCP connection, it stays connected for 180 seconds, then disconnects until the OS relinquishes the socket. The purpose of this microcontroller is for timing based controls, so a several second delay for reconnecting will not be usable.
I am posting on an Ubuntu forum not to hope someone can fix everything, but to see if this is possibly something to do with the OS, as I have spent a large amount of time attempting to fix the Teensy code and the python code.
Relevant System Information: Raspberry Pi 4, Teensy 4.1 native ethernet
Both devices have and keep a static IP address, and the Teensy keeps a static MAC address.
Symptoms:
During the disconnect, the raspberry pi thinks that it is still sending messages over the socket, but they are not being received by the Teensy. The Teensy stops being able to read any messages from pi after the 180 seconds have passed.
ARP ack is still coming from the Teensy.
A heartbeat message is sent every second to and from both devices, ensuring that a timeout issue is not occurring.
Once the TCP is broken, rebooting the Teensy reconnects the two. Also, unplugging and replugging the ethernet reconnects them.
If I wait a few more minutes, the two reconnect, as long as both of the scripts are still looking to start a new TCP connection.
Future
Please let me know if there is something I can run in the terminal or some program to figure out the root of the cause. This issue is very reproducible, always occurring 180 seconds after the connection begins.
Thanks in advance for any help!