Pyserial not getting response every time, input/output errors

R

Rainy

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:
'\x02\x00\'\x0c"\x00My Thermostat R1.0B'
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!
 
C

Carsten Haese

Rainy said:
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:

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.

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

Hope this helps,
 
R

Rainy

Carsten said:
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.

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

Hope this helps,

Thanks for the reply, Carsten, I should have mentioned.. yes, I did
confirm
that defaults pyserial's providing are correct with pcb maker.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top