Pyserial not getting response every time, input/output errors

Grant Edwards grante at
Tue Aug 12 22:33:52 CEST 2008

On 2008-08-12, Carsten Haese <carsten.haese at> wrote:
> Rainy wrote:
>> 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)
> One possible point of failure is that you're not supplying any 
> parameters for the data format (byte size, parity, stop bits) and flow 
> control. The Serial object will assume defaults, and those defaults may 
> or may not be correct.

None of those things are capable of creating an input/output
error -- you'll just get goofy data values (or no answer from
the device at the other end of cable).  An input/output error
usually means that there are issues with the underlying bus or
there are hardware failures.

> Try to find out what data format and flow control you should
> be using and set explicit Serial parameters accordingly.

Grant Edwards                   grante             Yow! ... If I had heart
                                  at               failure right now,
                                 I couldn't be a more
                                                   fortunate man!!

More information about the Python-list mailing list