Serial & reset of the device

Grant Edwards invalid at invalid.invalid
Fri Jul 8 09:56:12 EDT 2011


On 2011-07-08, Tim Chase <python.list at tim.thechases.com> wrote:
> On 07/08/2011 02:45 AM, Tim Roberts wrote:
>> yorick<yorick.brunet at gmail.com>  wrote:
>>> I'm trying to access a hardware board of my company through a serial
>>> connection using a Python script and the pyserial module.
>>>
>>> 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.
>>
>> 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.

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.

-- 
Grant Edwards               grant.b.edwards        Yow! Remember, in 2039,
                                  at               MOUSSE & PASTA will
                              gmail.com            be available ONLY by
                                                   prescription!!



More information about the Python-list mailing list