Serial port doesn't work after few minutes
-
I'm facing a weird behavior I have never seen before.
Raspbian Stretch, Qt 5.9.2.My application open a serial port (i.e. /dev/ttyUSB0) and I can send and receive data.
After few minutes (it's not always the same amount of time) the port seems to be still open, but no data is transmitted or received anymore. Closing and reopening the port will lead it back to work.I inspected dmesg and udevadm monitor but no activity is shown when this happens.
I changed RPi, USB dongle (tried with different chipsets), power supply, USB port and sd-card.Please note this doesn't happen all the times... in few cases it worked for at least 15 hours without any problem!
And it isn't related to the message exchanged: it happened even with no serial activity at all, and while exchanging data.Of course I'm not asking you a solution - would be nice, but I guess your crystal ball is still being repaired.
I'm not sure where is the root cause: hardware, operating system, my application...What I'm asking is any idea about how you would investigate further on such an issue.
-
Hi. I'm using QSerialPort in a lot of projects without any problem.
Normally your problem is related to the hardware.
But, when I'm not receive nothing from a serial port or from a tcp socket, I close and open the serial porto or the tcp socket.
I do this with QSerialPort but also with Delphi and other development platform because this problem can happen. -
@mrdebug said in Serial port doesn't work after few minutes:
But, when I'm not receive nothing from a serial port or from a tcp socket, I close and open the serial porto or the tcp socket.
I do this with QSerialPort but also with Delphi and other development platform because this problem can happen.Well, I cannot close and open the port because I don't know when I don't receive data :-)
I mean, I might wait for 6 hours before a message is actually sent to my system.Anyway, this problem must not happen! I have plenty of RPi out there that works with 4 serials each 24/7 for years... they never missed data!
I'm sure there's something wrong in this setup but I don't know how to find out what it is.
-
Hi,
Is this specific to 5.9.2 ?
Can you check with an earlier version ?
Can you check against 5.10 ? -
@SGaist said in Serial port doesn't work after few minutes:
Hi,
Is this specific to 5.9.2 ?
Can you check with an earlier version ?
Can you check against 5.10 ?I cannot easily check against other versions because I have to cross-compile all again. If I have some time I would do.
In the meanwhile I'm looking to find a configuration that works (I'm afraid about RPi revisions and USB converters).
Another test I'm going to do is understand if it's Qt- or system-related, i.e. open a serial terminal (minicom or just cat) and see what happens. -
You don't have to rebuild everything, you can start with only the
qtbase
module and then build only the modules you need with the usual comboqmake/make/make install
.