Mohamed Abdelaal
Mohamed Abdelaal

Reputation: 1

Fast asynchronous serial communication

I have a controller design application where i get data from 3 USB devices (seen as virtual com port under windows), process it, and then send the action to a 4th USB device (also virtual com port). I need to process that data once i recieve it with a minimum latency. I decided to use C++ on windows embedded and do the serial communication using the .Net System::IO::Ports and DataReceived event. I tested my code performance using only one USB device where USB device sends one byte to the computer and then the computer sends it back. I measure the time difference and it was totally indeterministic. Sometimes 2 ms and sometime 20 ms. Note: the process priority is set to be realtime.

Is it a better way to get a deterministic latency where a max delay is guaranteed? may be another API suitable for realtime serial communication on windows embedded?

Thanks in advance

Upvotes: 0

Views: 703

Answers (1)

Martin Verjans
Martin Verjans

Reputation: 4796

In Windows, you cannot get a deterministic latency delay. You cannot have any guarantee. Because it is not a real-time OS.

If you want some guarantee that are mandatory for your project, you can either deport the real-time part into a smaller device like Arduino (open-source, some users made a Real Time OS with it) or a Beck chip (commercial, delivered with a Real Time miniOS); or you can install a RealTime Linux, which brings in some guaranteed delay.

Upvotes: 0

Related Questions