#41 Avoid using the DTR signal



When I open a serial connection with pyserial, it seems that the pyserial library sends a DTR signal (even if I have dsrdtr=False).
Why is that?

ser = serial.Serial(com_port, 115200, timeout=5, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, xonxoff=False, rtscts=False, writeTimeout=None, dsrdtr=False, interCharTimeout=None);
ser.write("hello world\n");

If I do the same program in C, this does not happen.

That's a problem in my case, because I use the DTR signal for a special purpose.

How can avoid that pyserial sends a DTR signal?



  • Chris Liechti

    Chris Liechti - 2011-01-01

    Its typical for terminal applications to set DTR to "active" when the port is opened. "dsrdtr" only controls if hardware flow control is used, not if the control line is used.

    wehn no hardware fow control is configured, you can use ser.setDTR(False) to change the state of the line back.

  • Chris Liechti

    Chris Liechti - 2011-01-01
    • assigned_to: nobody --> cliechti
    • status: open --> pending
  • David Portabella Clotet

    Thanks for the quick reply.

    > you can use ser.setDTR(False) to change the state of the line back.
    That's too late for my case. (my device interprets the DTR "active" as the request to make a reset of my device).

    Is it possible to open the serial, and avoid setting DTR to "active"?

    I can modify your library for this, but maybe having this option in the official library is useful for other people?


  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

  • SourceForge Robot

    • status: pending --> closed
  • Comment has been marked as spam. 

    You can see all pending comments posted by this user  here

    Anonymous - 2012-03-21

    I would like to open this again: i'm doing some developing on the very popular Arduino-platform and it uses DTR to reset the microprocessor so that it can be programmed from a USB-serial port. The problem is now that each time I establish a serial connection to read some values from the Arduino the device is reset! Given the popularity of the platform I think it would be a good idea to have a way to avoid touching DTR on init!


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks