@addebito , I have an issue more or less the same as you.
I suppose the main issue comes from one program that has opened the serial port and initialed any DCB parameters, when your Qt program opens the device, Qt driver does not reset all DCB data, but some parameters did not suitable for QtSerialPort, so the issue comes up.
here is a DCB that first open after the PC reset:
[image: 12289801-ad2e-44f7-baf9-00fc46351e2e.png]
here is a DCB being opened by another program, it changed XoffLim/XonLim
[image: d65bfe48-77f2-4379-ae98-65e7f39ae8ed.png]
so, I write some code clear DCB before Qt open serial port:
#if (defined (_WIN32) || defined (_WIN64))
void clearSerialPort (const QString &path)
{
#include <winbase.h>
QString deviceString = path.startsWith(QLatin1String("COM"))
? (QLatin1String("\\\\.\\") + path) : path;
HANDLE handle = ::CreateFile(
reinterpret_cast<const wchar_t*>(deviceString.utf16()),
GENERIC_READ | GENERIC_WRITE,
0, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr);
if (handle == INVALID_HANDLE_VALUE) {
return;
}
DCB dcb;
memset(&dcb, 0, sizeof(DCB)); //::ZeroMemory(dcb, sizeof(dcb));
dcb.DCBlength = sizeof(DCB);
if (::GetCommState(handle, &dcb)) {
dcb.XoffLim = 0;
dcb.XonLim = 0;
::SetCommState(handle, &dcb);
}
::CloseHandle(handle);
}
#endif