Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I work in the automation industry (for close to 30 years now) where serial communication protocols are still widely used. Most programmable logic controllers and remote telemetry units still make use of the Modbus RTU serial protocol. The BACNet MSTP (Master Slave Token Passing) is another widely used protocol for the building automation industry in North America.

Both these protocols are well documented and have open source implementations available on the internet. The problem with the implementations I have seen so far is that they don't work perfectly on Windows platforms because of Windows' lack of precision timers (< 10ms) required for ideal implementation.

My goal is to develop a Widows Driver for the Modbus RTU protocol. This is a serial (RS485) protocol that requires accurate timing and a serial interface.

I think I need to use KMDF for the timing requirements. I think I need to use existing virtual or physical com port drivers in my driver stack? Which brings me to my question.

What would be the best approach to developing a Serial Protocol Driver, using the WDF, that uses KMDF for timing and can also access the PC com ports? Am I going off in the wrong direction?

I would describe my programming skill level as "A rusty intermediate C/C++" programmer. Meaning that I used to make a living as an embedded C programmer at an intermediate or senior level and have a very solid grasp of the C++ language. I have never developed a widows driver before but I would like to learn. I am reading up on the driver development process and asking questions. These days I work as a control systems integrator.

Please advise.
Posted

1 solution

Instead of fighting with Windows to get real time performance - move the problem outside the Windows host.

Get an Arduino Leonardo or low-cost derivative like the Beetle.

http://www.dfrobot.com/index.php?route=product/product&path=35_104&product_id=698[^]

The Leonardo family plug into a Windows USB port and have a separate RS232 port. You would need to add an RS485 adapter to the Leonardo.

You can write custom code to upload into the Leonardo to speak the Modbus RTU protocol and maintain real time constraints. A plug-in for building Arduino projects from Visual Studio exists. The Windows host can speak to the Leonardo using higher level messaging and relaxed timing constraints. The USB interface emulates a serial port so your user mode Windows programming would be familiar territory.

The Beetle is very cheap.

http://www.dfrobot.com/index.php?route=product/product&path=35_104&product_id=1075[^]

Good luck.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900