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.f d, 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! 3 6204
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.
Try to find out what data format and flow control you should be using
and set explicit Serial parameters accordingly.
Hope this helps,
--
Carsten Haese http://informixdb.sourceforge.net
Carsten Haese 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.
Try to find out what data format and flow control you should be using
and set explicit Serial parameters accordingly.
Hope this helps,
--
Carsten Haese http://informixdb.sourceforge.net
Thanks for the reply, Carsten, I should have mentioned.. yes, I did
confirm
that defaults pyserial's providing are correct with pcb maker.
On 2008-08-12, Carsten Haese <ca***********@ gmail.comwrote:
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,
visi.com I couldn't be a more
fortunate man!! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: TinyTim |
last post by:
I'm a newbie at ASP & HTML. It seems that when you use server side
code and you're going to return a customized HTML form with several
fields and labels, you have to do an extensive amount of
Response.Writes.
Are there any tools that will let you design the form then convert
that form to Response.Writes that you can further customize with ASP
logic? For instance: use Dreamweaver to design the form, then another
program to convert to...
|
by: Hitesh |
last post by:
Hi,
I am getting the response from another Website by using the HttpHandler in
my current site. I am getting the page but all the images on that page are
not appearing only placeholder are displayed.
Can anybody know this issue and help me to resolve this.
In past i received the response saying that i should download the image
first and then parse the actual response and modify the src attribute of the
|
by: Frederic Wenzel |
last post by:
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 ...
|
by: Jon |
last post by:
Hi,
I wrote some code to read in info from a port using pyserial. the code
reads info sent by a box that is connected to my computer by an
rs232-to usb adapter. When I was writing the code and testing it on my
computer it worked fine.
I ran py2exe on the program (which uses wxpython for its gui) and sent
the output from the py2exe to another computer. now when I try to run
it on this other computer it fails to open the port. it gives...
|
by: Lone Wolf |
last post by:
I'm trying to get data through my serial port from a CMUcam.
This gizmo tracks a color and returns a packet of data. The
packet has nine data points (well, really eight since the first
point is just a packet header) separated by spaces as follows: M
xxx xxx xxx xxx xxx xxx xxx xxx
Here is the code I am using (python v24):
import serial
| |
by: pauland80 |
last post by:
<snip>
<snip>
Late thanks for your both answers! (Please excuse me for that)
The problem was a bug in the device firmware.
But before finding this, I dugg lightly in the pyserial source and
found (to take with care!) :
|
by: Kineta |
last post by:
Hello all,
I am attempting to send commands to the firmware on my PIC18F4550 (usb port) microcontroller using Pyserial. If I open Hyperterminal, I can send the following commands and it works beautifully:
set_dac(0,1500,0)
report_smu
Then I went to Python with Pyserial, and nothing happens. I get no errors, but at the same time the board does not respond to the input, and python prints no output.
Here is my code:
|
by: Joe G \(Home\) |
last post by:
Hi All,
Background
===================
I have installed Python for windows today from the python web site .I also
installed pySerial using the Windows installer from the sourceforge web
site..... Both installs use the default directories.
Phyton version : Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) on win32
|
by: bryanleo |
last post by:
We are trying to read data from a microcontroller and interface it through serial port. The output is then displayed in Python using Pyserial or the hyperterminal, the former is more important
When you touch the input pins of the microcontroller the value changes real time in hyper terminal. But In the case of the pyserial module, even though you touch the input pins, the value does not change. We have actually noticed that python records and...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |