Hello! I'm having some trouble with pyserial package, I'm sending commands and reading responses from a custom pcb, and sometimes I get a proper response, at other times I get nothing, and sometimes I get about half of the response string with beginning cut off. About half the time an empty string is returned, the other ~half time good response, and more rarely I get partial response.
When I try to use the same Serial instance to send/receive a few times, I end up getting an input/output error. Here are some examples: >>> ser = serial.Serial('/dev/ttyAM1', 115200, timeout=0.1) >>> ser.write(chr(2) + chr(1) + chr(6) + chr(12) + chr(34) + chr(0) + chr(0)) >>> ser.read(60) '' >>> ser.close() >>> ser = serial.Serial('/dev/ttyAM1', 115200, timeout=0.1) >>> ser.write(chr(2) + chr(1) + chr(6) + chr(12) + chr(34) + chr(0) + chr(0)) >>> ser.read(60) '\x02\x00\'\x0c"\x00My Thermostat R1.0B' >>> ser.write(chr(2) + chr(1) + chr(6) + chr(12) + chr(34) + chr(0) + chr(0)) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.3/site-packages/serial/serialposix.py", line 372, in write n = os.write(self.fd, d) OSError: [Errno 5] Input/output error I tried timeout values from 0.1 to 3sec. Doesn't make a difference. Aside from the possibility of hw issue (I'm investigating this now), what else could it be? We tested this from a different computer from a Ferret terminal program using a different cable, and it worked without problem. I tried many different things, using miniterm.py provided with pyserial, getting newest version of pyserial, sending one char at a time, etc etc. I get same intermittent problems.. If anyone have an idea on what else I can try, please help! thanks! -- http://mail.python.org/mailman/listinfo/python-list