Re: Pyserial problem
> On 22 Dec 2022, at 17:09, Patrick EGLOFF wrote: > > Hi all, > > I use Python 3.10.9 and Pyserial 3.5 on a Win10 machine. > > I'm sending datas via an USB port to a device that accept commands in the > form of : cmd; > The device receives and reacts to the commands sent, and it should reply > with an ACK of the same kind. > > But looking with a COM port sniffer, nothing is sent back. > > I checked that everything is working with PUTTY and even MINITERM, and > everything is just fine, the device is responding correctly. > > I have set the flow control to different values, as well as setting the RTS > and DTR high or low with no change. > Normally, the device works without any flow control, and CTS + DTR high. > > I checked with MINITERM, that the flow control and control lines have the > same state. > > I'm a bit surprised and stucked. > Can someone help ? Please post tour code that you are using to talk to the device. Barry > Thanks, > -- > Patrick Egloff > email : pegl...@gmail.com > Web page : http://www.egloff.eu > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Pyserial problem
Hi all, I use Python 3.10.9 and Pyserial 3.5 on a Win10 machine. I'm sending datas via an USB port to a device that accept commands in the form of : cmd; The device receives and reacts to the commands sent, and it should reply with an ACK of the same kind. But looking with a COM port sniffer, nothing is sent back. I checked that everything is working with PUTTY and even MINITERM, and everything is just fine, the device is responding correctly. I have set the flow control to different values, as well as setting the RTS and DTR high or low with no change. Normally, the device works without any flow control, and CTS + DTR high. I checked with MINITERM, that the flow control and control lines have the same state. I'm a bit surprised and stucked. Can someone help ? Thanks, -- Patrick Egloff email : pegl...@gmail.com Web page : http://www.egloff.eu -- https://mail.python.org/mailman/listinfo/python-list
Re: Pyserial problem. script stops reading.
"Frederic Wenzel" [EMAIL PROTECTED] Wrote:On 9/9/06, Frederic Wenzel [EMAIL PROTECTED] wrote: On 9/9/06, Hendrik van Rooyen [EMAIL PROTECTED] wrote: | I wrote a script on Linux that uses pyserial to read status messages | from a serial line using readlines(). For now, it just displays what | it gets on stdout: | (...) | ser = serial.Serial(port=1, | baudrate=1200, | rtscts=1, | | If the script does not time out there, I am not sure what else it is | doing. It seems to be in a wait state it does not get out of.When it stopped working again (unfortunately) I pressed ctrl c and got thefollowing outputÖ14:53 | 0008 | 02 | | 5 |Rack Abs.| - | --75214:53 | 0005 | 02 | | 2 |Rack Abs.| - | 0075214:53 | 0008 | 02 |Traceback (most recent call last): File "serialhandler.py", line 34, in ? lines = sh.readLines() File "serialhandler.py", line 29, in readLines return self.ser.readlines() File "/usr/lib/python2.3/site-packages/serial/serialutil.py", line 78, inreadlines line = self.readline(eol=eol) File "/usr/lib/python2.3/site-packages/serial/serialutil.py", line 60, inreadline c = self.read(1) File "/usr/lib/python2.3/site-packages/serial/serialposix.py", line 269, inread ready,_,_ = select.select([self.fd],[],[], self._timeout)KeyboardInterruptApparently this is the place where it gets stuck. The select.selectline does not return, not even for a timeout.FredThis seems a real PITA - it looks normal to me - it is as if the device hassimply stopped sending for some reason. Can you:1) set the external device up to ignore flow control?2) check the cable for loose connections - wriggling it around while thetransmission is running might point at something - but be gentle - else you caneasily draw false conclusions, or break something that is in fact ok...does anybody else know how to check the value of the time out, what its for andwhat happens when it times out?- hth - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: pyserial problem: script stops reading
On 9/9/06, Frederic Wenzel [EMAIL PROTECTED] wrote: On 9/9/06, Hendrik van Rooyen [EMAIL PROTECTED] wrote: | I wrote a script on Linux that uses pyserial to read status messages | from a serial line using readlines(). For now, it just displays what | it gets on stdout: | (...) | ser = serial.Serial(port=1, | baudrate=1200, | rtscts=1, | | If the script does not time out there, I am not sure what else it is | doing. It seems to be in a wait state it does not get out of. When it stopped working again (unfortunately) I pressed ctrl c and got the following outputÖ 14:53 | 0008 | 02 | | 5 |Rack Abs.| - | --752 14:53 | 0005 | 02 | | 2 |Rack Abs.| - | 00752 14:53 | 0008 | 02 |Traceback (most recent call last): File serialhandler.py, line 34, in ? lines = sh.readLines() File serialhandler.py, line 29, in readLines return self.ser.readlines() File /usr/lib/python2.3/site-packages/serial/serialutil.py, line 78, in readlines line = self.readline(eol=eol) File /usr/lib/python2.3/site-packages/serial/serialutil.py, line 60, in readline c = self.read(1) File /usr/lib/python2.3/site-packages/serial/serialposix.py, line 269, in read ready,_,_ = select.select([self.fd],[],[], self._timeout) KeyboardInterrupt Apparently this is the place where it gets stuck. The select.select line does not return, not even for a timeout. Fred -- http://mail.python.org/mailman/listinfo/python-list
Re: pyserial problem: script stops reading
Frederic Wenzel wrote: On 9/9/06, Frederic Wenzel [EMAIL PROTECTED] wrote: On 9/9/06, Hendrik van Rooyen [EMAIL PROTECTED] wrote: | I wrote a script on Linux that uses pyserial to read status messages | from a serial line using readlines(). For now, it just displays what | it gets on stdout: | (...) | ser = serial.Serial(port=1, | baudrate=1200, | rtscts=1, | | If the script does not time out there, I am not sure what else it is | doing. It seems to be in a wait state it does not get out of. When it stopped working again (unfortunately) I pressed ctrl c and got the following outputÖ 14:53 | 0008 | 02 | | 5 |Rack Abs.| - | --752 14:53 | 0005 | 02 | | 2 |Rack Abs.| - | 00752 14:53 | 0008 | 02 |Traceback (most recent call last): File serialhandler.py, line 34, in ? lines = sh.readLines() File serialhandler.py, line 29, in readLines return self.ser.readlines() File /usr/lib/python2.3/site-packages/serial/serialutil.py, line 78, in readlines line = self.readline(eol=eol) File /usr/lib/python2.3/site-packages/serial/serialutil.py, line 60, in readline c = self.read(1) File /usr/lib/python2.3/site-packages/serial/serialposix.py, line 269, in read ready,_,_ = select.select([self.fd],[],[], self._timeout) KeyboardInterrupt Apparently this is the place where it gets stuck. The select.select line does not return, not even for a timeout. Fred Try running your program with python -i [programname.py] That way after you ^C it you'll be able to poke around a bit in an interactive shell (though I suspect that the stackframe contents will have been lost, so you'll only have globals to look at - that may or may not be enough). regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: pyserial problem: script stops reading
Frederic Wenzel [EMAIL PROTECTED] wrote: | I wrote a script on Linux that uses pyserial to read status messages | from a serial line using readlines(). For now, it just displays what | it gets on stdout: | | 17:42 | 0005 | 02 | | 5 |Rack Abs.| - | --210 | 17:42 | 0008 | 02 | | 5 |Rack Abs.| - | --210 | 17:42 | 0001 | 02 | | 5 |Rack Abs.| - | --210 | 17:43 | 0008 | 02 | | 5 |Rack Abs.| - | --210 | 17:43 | 0001 | 02 | | 5 |Rack Abs.| - | --210 | 17:43 | 0005 | 02 | | 5 |Rack Abs.| - | --210 | 17 | | After a few hours, or sometimes days, of listening, the script stops | in the middle of the line and does not display any further output (as | you can see with the 17 in the last line above). That happens, even | though I set a timeout of 10s when opening the line, and on timeout it | displays the lines and reopens the port: | | ser = serial.Serial(port=1, | baudrate=1200, | rtscts=1, if this is enabling hardware flow control try turning it off - at 1200 baud you should not need it | timeout=10) | | while 1: | lines = sh.readLines() | for line in lines: | print line | ser.close() | ser.open() | | If the script does not time out there, I am not sure what else it is | doing. It seems to be in a wait state it does not get out of. Sounds more and more like flow control hassle - can you lay your hands on a break out box or a datascope? | | So even if the line received turned out to have some sort of error, I | think it should time out after a while? Maybe there is some sort of | buffer overrunning (even though the traffic is quite low: a line every | few minutes on average)? | | Does anyone see any obvious error? Any hint how I can further debug the problem? | | Thanks | Fred - HTH Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: pyserial problem: script stops reading
On 9/9/06, Hendrik van Rooyen [EMAIL PROTECTED] wrote: | I wrote a script on Linux that uses pyserial to read status messages | from a serial line using readlines(). For now, it just displays what | it gets on stdout: | (...) | ser = serial.Serial(port=1, | baudrate=1200, | rtscts=1, if this is enabling hardware flow control try turning it off - at 1200 baud you should not need it Okay I disabled this for once. | | If the script does not time out there, I am not sure what else it is | doing. It seems to be in a wait state it does not get out of. Sounds more and more like flow control hassle - can you lay your hands on a break out box or a datascope? Unfortunately not. I will run a few more tests without rtscts though. I am actually not horribly worried about kicking the serial reading service every once in a while, but it would be better if it detected the stall state itself... Thanks Fred -- http://mail.python.org/mailman/listinfo/python-list
Re: pyserial problem: script stops reading
Frederic Wenzel wrote: On 9/9/06, Hendrik van Rooyen [EMAIL PROTECTED] wrote: | I wrote a script on Linux that uses pyserial to read status messages | from a serial line using readlines(). For now, it just displays what | it gets on stdout: | (...) | ser = serial.Serial(port=1, | baudrate=1200, | rtscts=1, if this is enabling hardware flow control try turning it off - at 1200 baud you should not need it Okay I disabled this for once. | | If the script does not time out there, I am not sure what else it is | doing. It seems to be in a wait state it does not get out of. Sounds more and more like flow control hassle - can you lay your hands on a break out box or a datascope? Unfortunately not. I will run a few more tests without rtscts though. I am actually not horribly worried about kicking the serial reading service every once in a while, but it would be better if it detected the stall state itself... You could maybe have another program monitoring it - I seem to remember the APSN database holding a UDP heartbeat program that might be readily adaptable. No time to Goog^w use a popular search engine to look for it just now, but you should have all the keywords ... regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
pyserial problem: script stops reading
I wrote a script on Linux that uses pyserial to read status messages from a serial line using readlines(). For now, it just displays what it gets on stdout: 17:42 | 0005 | 02 | | 5 |Rack Abs.| - | --210 17:42 | 0008 | 02 | | 5 |Rack Abs.| - | --210 17:42 | 0001 | 02 | | 5 |Rack Abs.| - | --210 17:43 | 0008 | 02 | | 5 |Rack Abs.| - | --210 17:43 | 0001 | 02 | | 5 |Rack Abs.| - | --210 17:43 | 0005 | 02 | | 5 |Rack Abs.| - | --210 17 After a few hours, or sometimes days, of listening, the script stops in the middle of the line and does not display any further output (as you can see with the 17 in the last line above). That happens, even though I set a timeout of 10s when opening the line, and on timeout it displays the lines and reopens the port: ser = serial.Serial(port=1, baudrate=1200, rtscts=1, timeout=10) while 1: lines = sh.readLines() for line in lines: print line ser.close() ser.open() If the script does not time out there, I am not sure what else it is doing. It seems to be in a wait state it does not get out of. So even if the line received turned out to have some sort of error, I think it should time out after a while? Maybe there is some sort of buffer overrunning (even though the traffic is quite low: a line every few minutes on average)? Does anyone see any obvious error? Any hint how I can further debug the problem? Thanks Fred -- http://mail.python.org/mailman/listinfo/python-list
pyserial problem: script stops reading
I wrote a script on Linux that uses pyserial to read status messages from a serial line using readlines(). For now, it just displays what it gets on stdout: 17:42 | 0005 | 02 | | 5 |Rack Abs.| - | --210 17:42 | 0008 | 02 | | 5 |Rack Abs.| - | --210 17:42 | 0001 | 02 | | 5 |Rack Abs.| - | --210 17:43 | 0008 | 02 | | 5 |Rack Abs.| - | --210 17:43 | 0001 | 02 | | 5 |Rack Abs.| - | --210 17:43 | 0005 | 02 | | 5 |Rack Abs.| - | --210 17 After a few hours, or sometimes days, of listening, the script stops in the middle of the line and does not display any further output (as you can see with the 17 in the last line above). That happens, even though I set a timeout of 10s when opening the line, and on timeout it displays the lines and reopens the port: ser = serial.Serial(port=1, baudrate=1200, rtscts=1, timeout=10) while 1: lines = sh.readLines() for line in lines: print line ser.close() ser.open() If the script does not time out there, I am not sure what else it is doing. It seems to be in a wait state it does not get out of. So even if the line received turned out to have some sort of error, I think it should time out after a while? Maybe there is some sort of buffer overrunning (even though the traffic is quite low: a line every few minutes on average)? Does anyone see any obvious error? Any hint how I can further debug the problem? Thanks Fred -- http://mail.python.org/mailman/listinfo/python-list