Serial Port not Opening
- 
I'm trying to serial connect to the arduino Mega board through QSerialPort.But,the port is not opening.I have checked the port and it is properly connected with the board.Also,I have updated all the drivers. I have checked the connection in Putty.exe..the data bytes are coming in the putty.exe.But, when I tries to run in Qt..It saya error like this: 
 Error opening serial port: "The semaphore timeout period has expired."
 bool QSerialPort::flush(): device not openforeach (const QSerialPortInfo &serial_Info, QSerialPortInfo::availablePorts()) { qDebug() << "Port: " << serial_Info.portName(); portname = serial_Info.portName(); qDebug() << "ProductId: " << serial_Info.vendorIdentifier(); vendorId = serial_Info.vendorIdentifier(); qDebug() << "VendorId: " << serial_Info.productIdentifier(); productId = serial_Info.productIdentifier(); } serial = new QSerialPort(this); serial->setPortName(portname); serial->setBaudRate(QSerialPort::Baud115200); serial->setDataBits(QSerialPort::Data8); serial->setParity(QSerialPort::NoParity); serial->setStopBits(QSerialPort::OneStop); serial->setFlowControl(QSerialPort::NoFlowControl); serial->setReadBufferSize(8192); // Sets the read buffer size to 8192 bytes serial->open(QIODevice::ReadWrite); if (serial->error() != QSerialPort::NoError) { qDebug() << "Serial port error: " << serial->errorString(); } else { qDebug() << "Port opened"; } QTimer *timer = new QTimer(this); connect(timer, &QTimer::timeout, this, &serial_link::serial_read); timer->start(1000);
- 
I'm trying to serial connect to the arduino Mega board through QSerialPort.But,the port is not opening.I have checked the port and it is properly connected with the board.Also,I have updated all the drivers. I have checked the connection in Putty.exe..the data bytes are coming in the putty.exe.But, when I tries to run in Qt..It saya error like this: 
 Error opening serial port: "The semaphore timeout period has expired."
 bool QSerialPort::flush(): device not openforeach (const QSerialPortInfo &serial_Info, QSerialPortInfo::availablePorts()) { qDebug() << "Port: " << serial_Info.portName(); portname = serial_Info.portName(); qDebug() << "ProductId: " << serial_Info.vendorIdentifier(); vendorId = serial_Info.vendorIdentifier(); qDebug() << "VendorId: " << serial_Info.productIdentifier(); productId = serial_Info.productIdentifier(); } serial = new QSerialPort(this); serial->setPortName(portname); serial->setBaudRate(QSerialPort::Baud115200); serial->setDataBits(QSerialPort::Data8); serial->setParity(QSerialPort::NoParity); serial->setStopBits(QSerialPort::OneStop); serial->setFlowControl(QSerialPort::NoFlowControl); serial->setReadBufferSize(8192); // Sets the read buffer size to 8192 bytes serial->open(QIODevice::ReadWrite); if (serial->error() != QSerialPort::NoError) { qDebug() << "Serial port error: " << serial->errorString(); } else { qDebug() << "Port opened"; } QTimer *timer = new QTimer(this); connect(timer, &QTimer::timeout, this, &serial_link::serial_read); timer->start(1000);@Vijaykarthikeyan is your PuTTY application (or any other application) currently using that port? 
- 
@Vijaykarthikeyan is your PuTTY application (or any other application) currently using that port? @mzimmers No..I closed it before running the qt.Actually ,I found the solution.Im initializing the class in both the serial_link.cpp and in main.cpp.So,both have opened the port that's why it is giving the error 
- 
V Vijaykarthikeyan has marked this topic as solved on
 
