Solved Problem facing with QT serial port module
I am facing an issue with the QT serial port module. I observed this from qt version 5.2.0 onwards and currently using 5.9.1.
Target board (samd20 xplainedpro) is connected with the on-board bridge chip called "EDBG" which is used on all ATMEL XPlainedpro kits.
The edbg chip serve as the serial to USB bridge for connecting the PC to the target board.
windows 7 operating system with qt 5.9.1 version
I could not able to receive any data after USB enumeration is complete and virtual serial port is created.
But the data is received and working fine after I do connect/disconnect operations using the windows hyper-terminal software utility.
The windows hyper terminal is working correctly from first connect operation itself.
Everytime, when the USB cable is removed and reconnected, the serial communication fails.
I have tested the QT simple terminal example application and the effect is same. the qt terminal works perfectly after I do connect/disconnect with hyper-terminal application for first time.
Is this related to error due to the serial port open or related to RTS/CTS pins? Please provide feedback about the possible causes and solutions to solve this issue.
webzoid last edited by
I initially had issues with a
QSerialPortwhere I wouldn't receive any data through the port.
This problem was solved by ensuring that the following properties were set correctly:
m_serialPort.setDataBits(QSerialPort::Data8); m_serialPort.setFlowControl(QSerialPort::NoFlowControl); m_serialPort.setStopBits(QSerialPort::OneStop); m_serialPort.setParity(QSerialPort::NoParity);
Thanks for your feedback.
I have identified that the problem is due to the EDBG chip (usb-serial bridge) which requires DTR signal to enable the serial port RXD and TXD pins.
Including the line of code "serial->setDataTerminalReady(true);" after opening the serial port, the serial port application is now working fine. I guess this is automatically carried out on hyper-terminal software and tera-term software.
Whether the communication uses the flow control or not,some of the hardware bridge requires the flow control signals to be set for the first time after power ON.
@Dhani thank you so much for your reply..., had the exactly same issue. Now solved thanks to your line of code. You are a life saver!
@Dhani - thanks from me too. This fixed the same problem I was having connecting to a virtual serial port on an NXP dev board.