完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我正在开发一种使用USB与计算机通信的产品。我有一个使用USB作为虚拟COM端口的工作版本,但我想尝试使用HID,因为它看起来更有趣:-少驱动器(在这个意义上,我不需要提供驱动程序)-显然我可以得到更低的延迟。y比C语言中的一个编译器我可以发送我需要的所有信息在一个数据包中发送,所以也为了日志记录的目的,我会在一个timeSo中记录一个数据包,我从MLA V2017Y03Y06中取出USB设备-HID -定制,并将它与我的板一起使用,它具有PIC32 MX530F128H。ED对PLIB的所有引用,替换了检查按钮和用我自己来切换LED的功能。演示编译,单元连接,由计算机识别(Windows 7)。Windows演示应用程序从它的VID/PID识别板,并开始通信。对于电位器读取,我只是替换它,所以我可以看到一个缓慢变化的价值,并有一段时间的一切工作。我看到模拟读取的值改变,如果我按下开关LED LED开关,按钮按下是公认的。但是,在50-80秒(不恒定)通信停止。我可以通过断开/连接单元(没有电源循环)重置通信,在关闭50/80秒之后,再次关闭/重新打开ApplicationBut,也可以看到通信停止,因为没有发送更多的数据包,没有接收到更多的数据包。在任意时间,如果我在调试模式闪动,并在任何时候停止。我应该在这里寻找什么?我真的不知道。在此期间,我找到了HTTPS://GITHUBCOM/SoDelnDr/HIDUE实用程序,它有一个更新版本的应用程序,它是为VisualStudio的当前版本编写的,有三种配置:控制台应用程序、Windows窗体、WPF。(谢谢Soldernerd!!!!!)
以上来自于百度翻译 以下为原文 Hi, I am developing a product that uses USB for communication with a computer. I have a working version that uses USB as a Virtual Com Port, but i wanted to try using HID as it seemed more interesting: - Driver-less (in the sense that I don't have to provide drivers) - Apparently i can get lower latency than a comport in C# - I can send all the informations i need to send in a single packet, so also for logging purposes i would get to log a packet at a time So, i took the USB Device - HID - Custom for from MLA v2017_03_06 and adapted it to be used with my board, which has a PIC32MX530F128H. I removed all references to PLIB, replaced the functions that check buttons and toggle leds with my own. The demo compiles, the unit connects, gets recognized by the computer (windows 7). The windows demo application recognize the board from its VID/PID and communication starts. For the Potentiometer Read i just replaced it with val = (val * 15 + (rand() & 1023) / 16; so i could see a slowly changing value and for some time everything works. i see the values changing for the analog read, if i press toggle led the led toggles, the button pressing is recognized. However, after 50-80 seconds (not constant) communication stops. I can reset the communication by either - Disconnect/Connect unit (without power cycling) - Close/Re open Application But again, after 50-80 seconds the communication stops. I can also see that communication stops because no more packets are sent, no more packets are received. I can also block communication at an arbitrary time if i flash in debug mode and halt at any time. What should i be looking for here? I really have no idea.. In the meantime, i found this https://github.com/soldernerd/HID_Utility which has an updated version of the application, written for the current versions of visual studio, with three configurations: console app, windows forms, WPF. (Thanks Soldernerd!!!!) |
|
相关推荐
1个回答
|
|
你有USB嗅探器来确认数据包没有被发送/接收吗?如果不是,那你怎么说呢?我可能会做一个调试构建(如你所做的),然后使用“停止”操作,当你看到事情停止。这将告诉你代码在哪里——在这里猜测,但是它可能在陷阱中,错误检查“while”循环,或者等待中间事务等的循环。你有WDT运行吗?苏珊
以上来自于百度翻译 以下为原文 Do you have a USB sniffer to confirm that the packets are not being sent/received? If not then how do you tell? I would probably do a debug build (as you ave done) and then use the 'halt' operation when you see things stopping. That will tell you where the code is - guessing here but it could be in a trap, an error checking 'while' loop or a loop waiting for something mid-transaction etc.. Do you have the WDT running? Susan |
|
|
|
只有小组成员才能发言,加入小组>>
4824 浏览 9 评论
1829 浏览 8 评论
1747 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
2954 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2059 浏览 5 评论
461浏览 1评论
1111浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
363浏览 0评论
263浏览 0评论
LAN9252使用SQI通信,进行数字复位后读BYTE_TEST异常
1799浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-24 21:16 , Processed in 1.232881 second(s), Total 75, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号