It works for me now, have to open the serial port first, then set parameters.
port = new QextSerialPort(comPort, QextSerialPort::EventDriven);
// qDebug()<<baudSel;
port->setBaudRate(baudSel);
port->setDataBits(DATA_8);
port->setParity(PAR_NONE);
port->setStopBits(STOP_1);
port->setFlowControl(FLOW_OFF);
port->setTimeout(500);
port->setRts(true);
port->setDtr(true);
port = new QextSerialPort(comPort, QextSerialPort::EventDriven);
port->open(QIODevice::ReadWrite);
// qDebug()<<baudSel;
port->setBaudRate(baudSel);
port->setDataBits(DATA_8);
port->setParity(PAR_NONE);
port->setStopBits(STOP_1);
port->setFlowControl(FLOW_OFF);
port->setTimeout(500);
port->setRts(true);
port->setDtr(true);
To copy to clipboard, switch view to plain text mode
QextSerialPort seems work fine.
will try QSerialPort later if having other problems and can't be resolved.
Many thanks on everyone on helping me on this.
Bookmarks