I am using STM Virtual Com Port (VCP) to send data from my firmware to my PC application using C# .NET
I have created a Windows PC application that reads the data using VCP
From my firmware, I am sending 512 bytes every second, but my PC application is not receiving the data every second. It needs to wait 8 second, for the buffer to be full before I receive a data callback
That means, it needs to wait 4096 bytes before, I receive the callback...
But I have configured, my port to timeout every 1 ms, but it is not working...
My code is below:
port1 = new SerialPort("COM171", 9600);
port1.WriteBufferSize = 1024;
port1.ReadBufferSize = 1024;
port1.WriteTimeout = 1;
port1.ReadTimeout = 1;
port1.Handshake = Handshake.RequestToSend;
port1.ReceivedBytesThreshold = 1024;
port1.DtrEnable = true;
port1.RtsEnable = true;
port1.ReceivedBytesThreshold = 1;
port1.Open();
Any idea how to fix this? I want to reduce the latency timer to 1ms or the receive buffer to be smaller = 512 bytes for every data callback?