QT SerialPort Connect Problem
-
I am currently making middleware utilizing QtSerialPort.
I want to connect this middleware with the Stm32 board to send and receive messages.
The following is the serial port setup and open and readyread implementation.
m_serialport.setPortName (portName); m_serialport.setBaudRate (QSerialPort::Baud115200); m_serialport.setDataBits (QSerialPort::Data8); m_serialport.setParity (QSerialPort::NoParity); m_serialport.setStopBits (QSerialPort::OneStop); m_serialport.setFlowControl (QSerialPort::NoFlowControl); m_serialport.open (QIODevice::ReadWrite); if(!m_serialport.isOpen()){ qDebug() << "Serial port open error"; return false; } else { QObject::connect(&m_serialport, &QSerialPort::readyRead, [&]() { on_serialRX(); }); }
My problem is that if I connect the middleware and STM immediately after uploading the source, the setup message does not come out.
After uploading the source, open the Arduino IDE monitor and receive the setup message, then close the monitor and connect to the middleware, message transmission and reception are normal.
Please tell me what i am doing wrong
thank you -
Hi,
What is that setup message ?
Uploading which source to the Arduino ?
How is the procedure different from the Arduino IDE and without it ? -
@SGaist
Thanks for taking an interest in my problem.I solved this problem.
QSerialPort::setDataTerminalReady() was set to false.
After setting it to true, the setup message comes in.But, even if the setting value is changed to false after setting it to true once, the message is still received.
If the message reception starts by raising the DTR to High, I think it is logically correct to lower the DTR to Low to stop the message reception, but the result was not.