SerialPort.setPortName(name);
SerialPort.setBaudRate(QSerialPort::Baud115200);
//设置数据位数
SerialPort.setDataBits(QSerialPort::Data8);
// 设置校验位
//SerialPort->setParity(QSerialPort::NoParity);
//设置奇偶校验
SerialPort.setParity(QSerialPort::NoParity);
// 设置流控制
SerialPort.setFlowControl(QSerialPort::NoFlowControl);
//设置停止位
SerialPort.setStopBits(QSerialPort::OneStop);
qDebug() << "Application path:" << name;
// 打开串口
if(SerialPort.open(QIODevice::ReadWrite))
{
// 设置波特率
//qDebug() <<SerialPort.waitForBytesWritten(3000);
//SerialPort.close();
}
//打开串口
else
{
QMessageBox::about(NULL, "提示", "串口无法打开\r\n不存在或已被占用");
return;
}
I am using qt C++ to refactor the dfu master station, currently I have a problem, that is, I want to communicate with 52840 simulated com but failed, I initialize, you see this is correct, I try to initialize the send command 0x06,0x01,0x0c after successful sending DFU did not respond, I want to know what's wrong. Thank you