Dear friend, have you found the solution or workaround? I had the same issue with CH340 chip. I was planning to use RTS# line to reset my MCU. The problem was that after PC reboot or USB replug COM settings resets to defaults with RTS# & DTR# enabled. Then I have undesired pulse at first port opening with CreateFile() until DCB init with SetCommState(). With WCH VCP driver I have option DisableModemHandShake (see picture). With this option checked, the problem was solved, RTS# & DTR# lines not asserts, even after USB replug, DCB reading gives fRtsControl, fDtrControl = 0. However, I still can use these signals with EscapeCommFunction() method. FTDI VCP driver gives similar option (disable modem signals at startup), but unfortunately it doesn't work same way :( Did you solve the problem with FT232 chip?
HANDLE hComPort;
char szComPortName[20];
// ...
/* Try open */
hComPort = CreateFile(szComPortName, (GENERIC_READ | GENERIC_WRITE), 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
// RTS# & DTR# signals asserted now
if (hComPort == INVALID_HANDLE_VALUE) {
GetLastErrorMessage();
return false;
}
/* Set params */
DCB dcb {};
dcb.DCBlength = sizeof(DCB);
GetCommState(hComPort, &dcb);
dcb.BaudRate = (DWORD)baud;
dcb.fBinary = 1;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
dcb.fRtsControl = RTS_CONTROL_DISABLE;
dcb.fDtrControl = DTR_CONTROL_DISABLE;
if (!SetCommState(hComPort, &dcb)) {
GetLastErrorMessage();
Close();
return false;
}
// RTS# & DTR# signals disabled after SetCommState() success.