I'm trying to get serial data from my Adafruit Feather RP2350 via USB for debug purposes. My test code sends out an incrementing number every x seconds. If x == 1 second, it works no problem with any serial monitor (such as tio, minicom, or the Arduino IDE). However, if x >= 2.3 seconds, the data stops after a message or two. The serial port doesn't disconnect when the issue occurs, I only get disconnect alerts when I reset or physically unplug the board. I have tried multiple microcontroller boards from multiple brands, I've switched cables, USB ports, nothing works. This issue occurs on my Debian 12 Framework 13 laptop and my partner's Debian 13 Thinkpad T480s, but not my Debian 10 server, my freshly reflashed Raspberry Pi 3, or my WIndows 10 PC. Those computers accept the data just fine. I know the code is running properly on the boards because I set the built in LED to flash every time a serial message is sent out. The common factor seems to be our laptops.
I have checked lsof /dev/ttyACM0 to rule out other software grabbing the serial port, I've checked udev and stty rules (well, my partner did) to the best of my (well, her) ability, everything is identical between the different computers serial settings. My partner updated her kernel to the latest version and it still occurs.
I'm out of ideas, and this issue has completely stopped my personal projects. Does anyone have any ideas what could be going wrong? I know this isn't strictly an Arduino problem but I'm hoping someone here can help out regardless.
The problem is probably caused by your sketch but as you did not post it we can't tell
Please post your full sketch, using code tags when you do
Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination
In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.
I'm assuming by this you mean that it happens not only with an Adafruit Feather RP2350 but also (for example), an Uno R3, Pico, Nano Every, Wemos D1 mini, that kind of thing?
Anything of note in dmesg, syslog, debug, kern.log, daemon.log, etc.?
Have you tried it with a USB/serial cable with Tx and Rx jumpered together, and sending a character from your PC, waiting a few seconds, sending another character?
Ah well, it seemed at least a possibility. You wouldn't have them installed on a server and brltty is not usually installed on the Pi or Windows by default, but it might be on a Linux workstation so it seemed to kind of fit your list of working and non-working computers. Since they are not present, then there must obviously be another explanation.
You have already checked udev and stty. Have you checked whether the logged in user is a member of the dialout and plugdev groups?
You can check udev events with:
sudo udevadm monitor
This would show events such as the device being unplugged - or if it is randomly disconnecting and re-connecting for some reason.
Not sure what else to suggest at the moment. It does seem a bit odd.
The only time I've seen anything like that was with a Pico (RP2040) and ModemManager was running unbeknownst to me. The serial connection would work (mostly) but it was unstable. I'd lose characters and get odd hangs.
All the computers that work are fixed in positions (ie the server is in a rack in a closet) that I can't easily work around. I would much prefer working from my laptop. I know that's not a great answer but it's what I got.
Just an unlikely thought - laptops sometimes have some pretty aggressive power management options. While it's hard to believe a timeout for that purpose that's as short as you describe, it might be worth looking at the settings on the laptop. Look for something that allows you to disable such features, or at least set the timeouts for more reasonable periods.