I've been running and communicating with my Arduinos for over a year. I'd open the port and configure it with no issues.
Now, with the latest driver on a couple machines, the configuration fails with a 87:ERROR_INVALID_PARAMETER:
HANDLE WIN_CALL OpenPA(char* SerialPort, char* Config, int TIMO)
{
HANDLE hComm; DCB dcb; COMMTIMEOUTS CommTimeouts; // comm structures
// MessageBox(0, Config, "Danny Rules!", 0); return 0;
hComm = CreateFile(SerialPort, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
if (hComm == INVALID_HANDLE_VALUE) HANDLEERROR(SerialPort); // check open
if (strlen(Config)>2) {
if (!BuildCommDCBA(Config, &dcb)) return 0; // set configuration
if (!SetCommState(hComm, &dcb)) HANDLEERROR(Config);} // configure
if (!PurgeComm(hComm, 0XF)) HANDLEERROR(""); // clear operations and buffer
CommTimeouts.ReadIntervalTimeout = 10; CommTimeouts.ReadTotalTimeoutMultiplier = 10; CommTimeouts.ReadTotalTimeoutConstant = TIMO;
CommTimeouts.WriteTotalTimeoutMultiplier = 10; CommTimeouts.WriteTotalTimeoutConstant = 100;
if (!SetCommTimeouts(hComm, &CommTimeouts)) HANDLEERROR(""); // set timeout
return hComm;
}
BTW: I can no longer communicate with the Arduino using TeraTerm/Putty neither. Of course, communicating using Arduino serial monitor and Keysight VI works fine.
BBTW: Not that it makes a difference, but the config string is: [color=purple]baud=115200 parity=N data=8 stop=1[/color]