Avoid any changes on serial handshaking lines
-
Here my functions to open and close a serial port:
QSerialPort _serial; bool MySerial::open(QString port, quint32 baudrate) { _serial.setPortName(port); _serial.setFlowControl(QSerialPort::NoFlowControl); if (_serial.open(QIODevice::ReadWrite)) { _serial.setRequestToSend(false); _serial.setDataTerminalReady(false); _serial.setBaudRate(baudrate); _serial.flush(); return true; } else return false; } void MySerial::close() { _serial.close(); }
The serial port is actually an FT232RL USB/TTL converter. The remote device is a board with an ESP32. The handshaking signals (RTS, DTR) are use to reset the board and to put the MCU in bootloader mode.
Under Linux (Qt 6.6.0) no problem, the code above just opens and closes the port without changing the handshaking lines (even without explicitly setting their state).
Instead, under Windows 7 (Qt 5.15) when the port closes those signals change for a while causing a reset of my board and often put it in bootloader mode.
How can I avoid this behavior?
-
Here my functions to open and close a serial port:
QSerialPort _serial; bool MySerial::open(QString port, quint32 baudrate) { _serial.setPortName(port); _serial.setFlowControl(QSerialPort::NoFlowControl); if (_serial.open(QIODevice::ReadWrite)) { _serial.setRequestToSend(false); _serial.setDataTerminalReady(false); _serial.setBaudRate(baudrate); _serial.flush(); return true; } else return false; } void MySerial::close() { _serial.close(); }
The serial port is actually an FT232RL USB/TTL converter. The remote device is a board with an ESP32. The handshaking signals (RTS, DTR) are use to reset the board and to put the MCU in bootloader mode.
Under Linux (Qt 6.6.0) no problem, the code above just opens and closes the port without changing the handshaking lines (even without explicitly setting their state).
Instead, under Windows 7 (Qt 5.15) when the port closes those signals change for a while causing a reset of my board and often put it in bootloader mode.
How can I avoid this behavior?
@Mark81 said in Avoid any changes on serial handshaking lines:
How can I avoid this behavior?
Ask the vendor of the hardware to fix their windows drivers. When you look around you will find a lot of such strange issues with serial ports on windows. There is nothing what Qt can do here since it's an underlying problem of the serial to usb driver.
-
@Mark81 said in Avoid any changes on serial handshaking lines:
How can I avoid this behavior?
Ask the vendor of the hardware to fix their windows drivers. When you look around you will find a lot of such strange issues with serial ports on windows. There is nothing what Qt can do here since it's an underlying problem of the serial to usb driver.