如何创建使用PC com端口的WDF串行协议驱动程序 [英] How do I create a WDF Serial Protocol Driver that uses a PCs com ports

查看:69
本文介绍了如何创建使用PC com端口的WDF串行协议驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在自动化行业工作(近30年),其中串行通信协议仍被广泛使用。大多数可编程逻辑控制器和远程遥测单元仍然使用Modbus RTU串行协议。 BACNet MSTP(Master Slave Token Passing)是另一种广泛使用的北美楼宇自动化行业协议。



这些协议都有详细记录,并有开源实现可在互联网上找到。到目前为止我所看到的实现问题是它们在Windows平台上无法正常工作,因为Windows缺乏理想实现所需的精确定时器(<10ms)。



我的目标是为Modbus RTU协议开发一个Widows驱动程序。这是一个串行(RS485)协议,需要精确的时序和串行接口。



我认为我需要使用KMDF来满足时序要求。我想我需要在驱动程序堆栈中使用现有的虚拟或物理COM端口驱动程序?这让我想到了我的问题。



使用WDF开发串行协议驱动程序的最佳方法是什么,它使用KMDF进行计时,也可以访问PC通讯端口?我是否朝错误的方向前进?



我将我的编程技能水平描述为生锈的中级C / C ++程序员。这意味着我曾经在中级或高级水平上作为嵌入式C程序员谋生,并且非常扎实地掌握了C ++语言。我以前从未开发过寡妇司机,但我想学习。我正在阅读驱动程序开发过程并提出问题。这些天我作为控制系统集成商工作。



请指教。

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.

推荐答案

而不是与Windows获得实时性能 - 将问题移出Windows主机。



获取Arduino Leonardo或甲壳虫等低成本衍生产品。



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



莱昂纳多家族插入Windows USB端口和一个单独的RS232端口。您需要为Leonardo添加一个RS485适配器。



您可以编写自定义代码上传到Leonardo以说出Modbus RTU协议并保持实时约束。存在用于从Visual Studio构建Arduino项目的插件。 Windows主机可以使用更高级别的消息传递和宽松的时序约束与Leonardo交谈。 USB接口模拟一个串口,因此您的用户模式Windows编程将是熟悉的领域。



甲壳虫非常便宜。



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



祝你好运。
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.


这篇关于如何创建使用PC com端口的WDF串行协议驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆