Serial & reset of the device

Y

yorick

Hello,

I'm trying to access a hardware board of my company through a serial
connection using a Python script and the pyserial module.

I use Python 2.7.1 with Ubuntu 11.04 (pyserial is the package python-
serial with version 2.5.2, http://pyserial.sourceforge.net/pyserial_api.html).

The board to which I'm trying to connect works correctly with serial
as some other guys did some TCL scripts to manage it.
My problem is that every time I open a new connection, the device is
reset. I'd like to not have the device reset.

The code is the following :

handler = serial.Serial(port=self.portname, baudrate=9600,
bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stHello,

I'm trying to access a hardware board of my company through a serial
connection using a Python script and the pyserial module.

I use Python 2.7.1 with Ubuntu 11.04 (pyserial is the package python-
serial with version 2.5.2, http://pyserial.sourceforge.net/pyserial_api.html).

The board to which I'm trying to connect works correctly with serial
as some other guys did some TCL scripts to manage it.
My problem is that every time I open a new connection, the device is
reset. I'd like to not have the device reset.

The code is the following :

handler = serial.Serial(port=self.portname, baudrate=9600,
bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE, timeout=None, dsrdtr=False)
# here the device is reset ...

handler.close()


I found the following post http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274205532
but I haven't tested it yet as I don't like the idea to change files
managed by the system (and it is for Windows).

Is there any possibility to not reset the device when opening the
connection ?

Thanks,
Yorickopbits=serial.STOPBITS_ONE, timeout=None, dsrdtr=False)
# here the device is reset ...

handler.close()


I found the following post http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274205532
but I haven't tested it yet as I don't like the idea to change files
managed by the system (and it is for Windows).

Is there any possibility to not reset the device when opening the
connection ?

Thanks,
Yorick
 
T

Tim Chase

I'm not sure what that means. The RS-232 standard does not have the
concept of "reset". What is it that triggers a device reset?

While not a "reset" per-se, it might be triggered by the RTS/CTS,
DSR/DTR, or carrier-detect pins depending on the configuration.
Without the code and with minimal pySerial experience, I don't
know whether opening a serial-port in pySerial automatically
lights up one of those aux. lines and unsignals it when the
connection is closed. If the device expects a "power on" signal
on one of those pins, I'd start by looking to see if pySerial's
..close() drops the signal on those pins and if it offers a way to
keep the signal high while releasing the port. Otherwise, you
may have to open once, do all your work and only close the port
when you're done (and the device can be reset)

-tkc
 
G

Grant Edwards

While not a "reset" per-se, it might be triggered by the RTS/CTS,
DSR/DTR, or carrier-detect pins depending on the configuration.
Without the code and with minimal pySerial experience, I don't
know whether opening a serial-port in pySerial automatically
lights up one of those aux. lines and unsignals it when the
connection is closed.

On Unix, the serial port device driver generally turns DTR and RTS off
when a port is closed and turns them on when it's opened. I don't
know what Windows does. A quick glance through the pyserial sources
shows that it turns on DTR and RTS when a port is opened, and does
nothing with them when a port is closed.

If you need RTS/DTR to stay in a known state, then open the port, set
them to the state you want them, and keep the port open.
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top