QSerialPort starts communication after to some data were transmitted

188 views Asked by At

I am trying to send and receive some serial data with QSerialPort but it take a little time. So I open a Serial Terminal. (Terminal v1.93b - 20141030B) Then with it terminal I read and send data and when I tried again with my application, it starts correctly.

So why it happens after do I open the serial terminal and some data are sended the QSerialPort works fine. It looks like if I need to reset or refresh the serial buffer on my port.

1

There are 1 answers

0
Vladimir Bershov On

Try to call the function clear() after opening a serial port, or to call the function flush() after each sending data.

bool QSerialPort::clear(Directions directions = AllDirections)
bool QSerialPort::flush()