Reputation: 4970
I'm writing a simulator for XCP - an automotive protocol - on the PC.
I'm using a USB-to-CAN device and C++.
The issue with implementing this on PC, as opposed to on embedded hardware, is that XCP has very tight timeout message-reply requirements; it can be as low as 100us
.
The actual code that would be running on the PC is trivial because it would merely return dummy data.
QUESTION
Given my requirement for 100us
response time, is it even possible to achieve on PC running Windows 10 consistently?
Upvotes: 0
Views: 544
Reputation: 385204
No.
Task scheduler resolution in userspace on a PC is in the order of milliseconds, not microseconds, so even just context switching blows your budget out of the water.
There is no way you can guarantee real-time execution in such an operating system, except possibly by writing a kernel driver (though whether that's even true is beyond my expertise).
You really need to be doing something like this in hardware or firmware.
Upvotes: 2