Reputation: 41
At the moment we use the .Net built-in SerialPort component to communicate with different sensors via RS485. This shows a latency of more than 10 ms between the arrival of the messages until the DataReceived event is triggered or SerialPort.ReadLine is terminated.
The connected sensors respond in < 1ms and the transmission takes 1 to 3 ms (2 or 3 MBaud/s). These can also be read out so quickly via a microcontroller.
Is it possible to accelerate this? Or are there useful 3rd party components which are in the range of less than 10 ms latency?
Upvotes: 3
Views: 899
Reputation: 908
I just went through the source code, it doesn't seem the code is delaying the response.
https://referencesource.microsoft.com/#system/sys/system/io/ports/SerialPort.cs
However you can follow the article to change that in Device Manager and see if that works.
https://store.chipkin.com/articles/rs232-how-do-i-reduce-latency-on-com-ports
Edit
As the solution describes that you can go to your device manager and find your serial port from the list. There is a latency timer setting and you can updated that to 1 ms.
1 Start menu–> Settings –> Control panel –> device manager –> Ports (COM & LPT) –>{Select your USB to RS485 converter}
2 Right click and select “Properties”
3 Select the “Port Settings” tab
4 Click the “Advanced ” button
5 Change the Latency Timer (mSec) to 1 or the lowest possible setting.
6 Change the USB Transfer sizes to 64 or the lowest possible settings.
7 Save and close.
Upvotes: 1