I'm using the Win32 API to read data from a serial port:
DWORD numRead = 0;
ReadFile(mPortHandle, mReceiveBuffer.get(), mReceiveBufferSize, &numRead, nullptr);
This call takes extremely long: 129ms to be accurate (measured via QueryPerformanceCounter).
I did the measurement with several different hardware devices:
- USB adapter with FTDI chipset
- USB adapter with prolific chipset
- PCI express RS232 card
- Mainboard's onboard serial port
Evvery of these devices gives me exactly the same delay: 129ms. Thus I don't think its the hardware or the driver's fault (each device should be using a totally different driver, right?).
I also fiddled around with timeouts, but that did not change anything.
What else could it be?
NtReadFile
really returnSTATUS_TIMEOUT
i guess if you got 0 bytes / you need set COMMTIMEOUTS first – RbMm