Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

DTR resets when changing baud rate of QSerialPort object on Windows systems.



  • Unfortunately (re)setting the DTR line state via setDataTerminalReady does not change the DCB for the Windows serial port object. The function only uses the EscapeCommFunction of Windows. Result is, for example, changing the serial port baud rate will (re)set DTR line to it's initial state, too. Unfortunately there are some serial devices available using the DTR line for internal reset.
    A scenario where this might be pain in the a... is describerd here:
    1.) clear DTR to let the device run.
    2.) Send device command to make it work with higher baud rate.
    3.) Set serial port to this higher baud rate.
    4.) DTR is reset to it's initial state, device goes thru reset and works with it's initial baud rate.....
    Would be good to add something like the following in future code releases:

        if (set) {
            EscapeCommFunction(Win_Handle, SETDTR);
            Win_CommConfig.dcb.fDtrControl = 1;
        }
        else {
            EscapeCommFunction(Win_Handle, CLRDTR);
            Win_CommConfig.dcb.fDtrControl = 0;
        }
    

    Any comments?
    THX



  • Hi.

    Hmm. It is interesting things, thanks. :)
    We can discuss about it on bug-tracker. Please add your issue there.



  • Thanks, I added my issue there, but as a suggestion....
    Hopefully we can discuss it there....
    THX



  • Can you please provide an url to the issue?

    UPD:

    I found and re-assign Issue to me, see here: https://bugreports.qt-project.org/browse/QTBUG-36490


Log in to reply