USB 清晰端点功能
我正在为 USB 设备开发 CDC 驱动程序,我偶然发现了一些问题。 我在 Windows 端使用的驱动程序使用清除端点功能作为某种刷新机制或获取正确的数据。 这给我带来了很多麻烦,因为我无法让它工作。 我认为数据切换不同意,并且我错过了一些重要的数据传输,甚至由于清除数据切换不良而没有获得与该端点相关的中断。 我在设置接口和清除功能时将数据切换重置为 0,如 USB 标准中所指出的。 还有更多情况我应该这样做吗? 或者是否有简单的方法来处理无效数据切换的错误。
感谢您的解答。 我有 USB 分析仪,但现在没有任何用处。 根据我所能收集到的信息,我认为正在发生。 我在清除功能(应该这样做)之后在硬件中为相应端点设置了数据切换位。 发送一些数据,PC上接收到。 我知道这种形式的 USB 分析器,并且我使用端口监视器跟踪了我的 Vcom 驱动程序。 然后,我等待一些数据,因为所有内容都已配置(枚举设备等),第一个问题已得到解答,但下一个问题没有得到解答,在清除端点功能后,PC 端再次询问该问题。 这应该会触发相应端点的 UBS 中断,但它并没有发生,一段时间后再次出现明显的端点功能和相同的包,并且一次又一次地得到响应,通信协议上保持沉默。 我计算了请求的传输与丢失的中断,比率正好是 2:1,所以我认为数据切换有一半的时间设置错误,但是如果我每次获得清除端点功能时都设置数据切换位,怎么会发生这种情况。
我希望我清楚地说明了问题,对于哈佛方面,我认为唯一相关的是我设置的位。 它指出“向该位写入 1 可将端点数据切换重置为 0”。 好吧,我想(希望)我解决了清除端点的问题,其他错误是由其他事情引起的,并且累积问题很难发现。
好吧,我前段时间解决了这个问题,现在我什至不记得原因是什么,但像往常一样 - 这是别的东西。 感谢所有与 anwser 相关的人。
I am developing CDC driver for USB device and I stumble on some problem.
The driver I am using on windows side uses Clear endpoint Feature as some kind of flish mechanism or to get data right. That causes me a lot of trobule because I cant get it working. I think data toggle don't agree and I am missing some important data transfer, even not getting associated interrupt with that endpoing because of bad clear data toggle.
I reset data toggle to 0 at set interface and clear feature, as pointed out in USB standard.
Is there more situation when I should do this? Or is there easy way of error handling invalid data toggle.
Thanks for anwsering. I have got usb analyzer, but I dosen't do me any good now. From what I can managed to gather and I think is happening. I set datatoggle bit in hardvare after Clear feature (as it should be done) for coresponding endpoint. Send some data, It is recived on PC. I know this form USB analyzer and I traced my Vcom driver with port monitor.
Then I wait for some data as everything is configured (device enumerated and so on), the initial question is anwsered but the next one is not, after clear endpoint fature the PC side is asking the question again. This should trigger UBS interrupt for coresponding endpoint but it isint happening, again after some time there is clear endpoint feature and the same package, and it's get responded this time and again there is silence on the comunication protocol. I counted the requested tranfer versus missing interrupts and the ratio is exactly 2:1 so i think data toggling is set wrong by half of the time, but how can this be happening if i set data toggle bit every time I get clear endpoint feature.
I hope I stated the problem clearly, for the harvare side I think the only rvelant thing is the bit I am setting. It states "Write a 1 to this bit to reset the endpoint data toggle to 0."
Ok i think(hopefully) I solved the Clear endpoint fature, other errors were caused by other things, and cumulative problem was hard to catch.
Ok I fixed the issue some time ago, now I don't even remeber what was the cause but as ususally is - it was something else. Everyone who tied to anwser thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请注意,在某些版本的 usbser.sys 上,Windows 在传输 64 字节的精确倍数后无法正确刷新管道。 从你的问题中我并不清楚这是否是你所看到的行为,但 USB 分析器应该可以帮助你确定是否是这种情况。 如果您使用的是 XP SP2,请升级到 SP3。
Be aware that on some versions of usbser.sys, Windows does not correctly flush the pipe after a transfer of an exact multiple of 64 bytes. I'm not exactly clear from your question whether this is the behaviour you are seeing, but a USB analyser should help you determine if this is the case. If you are using XP SP2, upgrade to SP3.
我建议使用 usb snoopy (软件 USB 分析器)来了解您做错了什么。 如果您有预算,您最好购买硬件 USB 分析仪,例如 Lecroy 或 Ellisys。 或者获取商业 CDC 驱动程序,只需 google 即可找到足够的 CDC 驱动程序。
你的问题描述很笼统,可以直接解决。
I suggest to use usb snoopy (software usb analyzer) in order to understand what are you doing wrong. If you have any budget you better got hardware usb analyzer such us Lecroy or Ellisys. Or get a commercial CDC driver there is plenty available just google for cdc driver.
Your problem description is very general and can be addressed directly.