I'm using a Raspberry PI Zero W to communicate with another device over the serial port. Essentially, I'm facing the same issues as the unsolved thread in https://www.raspberrypi.org/forums/view ... p?t=110501 .
To make it short:
Serial communication works perfectly. I fire up screen (screen /dev/ttyS0 9600) and communicate with no apparent errors. It'll work for a day, two days, five days, but eventually it'll break down. The other end can still receive what I type, but I can no longer read what I'm receiving. No amount of text sent, or time waited seems to fix it. Rebooting the PI immediately solves the problem.
Because it's not the other end (since rebooting the PI restores functionality and the other device does not even realize the PI was rebooted), I assume it's a problem on the PIs end - maybe an issue with synchronization - I wouldn't know. My question is, whether, and how, it is possible to just reset the serial port, without rebooting. Just forget the whole state, and start anew.
Just to anticipate a few questions that were asked in the other thread - the baud rate is 9600, the cable is unshielded, goes to the moon and back, while spinning seven loops around a mains voltage cable, and the voltage level gets adjusted eighteen times. The point is, it works - for a really long time. It still works one-way (to the other end) when it breaks down. Okay, it desyncs. No problem. Can the port be reset without "sudo reboot"ing the PI?