I'm reading from a COM port at a high speed (3,686,400 b/sec). In order to accomplish this I have to read with 512-byte blocks and significantly increase my timeout (to 1000) so that I'll get a whole block each time and not pieces of it even though I'm reading synchronously.
The problem: after a few minutes of running and plotting the results just fine, I'm getting corrupted information. Meaning I still don't get the info at the pace I want it to be, but significantly delayed.
This specifically happens when I'm loading more on the software like running a recording thread that writes the data to a file. The resulting file is a much shorter file than expected, even though not corrupted (its like I'm getting the beginning of the transmitted data and not all of it).
I know its not the sending device since reloading the PC application while the device still sends data reinitialized the whole thing.
If it matters, I'm using windows 7, Intel core i3, 64-bit. Writing in C code in CVI. Reading COM port using Windows API.
Any suggestions?
Thank you