完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我用CY8C34 46PVI-076创建了一个“测试”(HID)USB PCB,并在Windows 10框(使用CyUSB。DLL)上有一个简单的“测试”应用程序(Cβ)。我可以连接到设备,并可以通过应用程序上的“发送”/“ReV”按钮发送/ReV数据,从而确认到/来自设备的通信。我不知道,我也找不到关于它的任何信息。应用程序如何告知USB设备是否有数据可不请求?比如说,我给设备增加一个按钮。我可以用我想发送给PC应用程序的数据填充缓冲区,但是应用程序如何知道数据是可用的?是否有一些中断标志我可以测试,或者我必须轮询设备(并测试一些状态位)来查看数据是否可用。我宁愿不投票,因为叶(n)MSEC间隔,数据可能是悬而未决的,帽子可能会导致一个滞后的时候,按钮被推到时间的应用程序推送。在某个时间点增加轮询时间,以减少滞后,将使应用程序迟缓用户输入。
这可能是我面对的那些解决方案之一,但我就是看不见。 例如,从PSoC Creator来说,事情很简单,看看数据是从PC发送的,我可以做一些类似的事情; 如果(UBJGETEPSTATE(OUTHEP)= = UBSUTHOUB Buffr充分)…处理应用程序的数据。 那么,有什么类似的我可以做的应用程序?类似的东西; 如果(MyHIDDEV)???????= = iNi Buffr充分)。处理设备数据。 以上来自于百度翻译 以下为原文 I've created a 'test' (HID) USB PCB using CY8C3446PVI-076 and have a simple 'test' app (C#) on a Windows 10 box (using CyUSB.dll). I can connect to the device and can send/recv data via a "Send"/"Recv" buttons on the app, so communication to/from device is confirmed. What I can't figure out, nor can I find any info about it, is.. how can the app tell if there is data available from the USB device without requesting it? For example, say I add a push button to the device. I can fill the IN buffer with the data I want to send to the PC app but how does the app know data is available? Is there some interrupt flag I can test, or do I have to poll the device (and test some status bit) to see if data is available. I'd prefer not to poll as that leaves (n)mSec intervals where data could be pending and hat may cause a lag from the time the button is pushed to the time the app acks the push .. at some point increasing poll time, to reduce the lag, will make the app sluggish to user inputs. This is probably one of those solutions that is staring me in the face, but I just can't see it. For example; from PSoC Creator things are simple enough; To see if data was sent from PC I can do something like; if (USB_GetEPState(OUT_EP) == USB_OUT_BUFFER_FULL) .. process the app's data.. So, is there something similar I can do from the app? Something like; if (myHidDev.????? == IN_BUFFER_FULL) .. process device data.. |
|
相关推荐
1个回答
|
|
你好,
在USB协议中,USB设备无法向自己的主机发送中断或信息。主机必须ping数据。 通常,主机调用DATAtRANSFER API以获取被调用的数据以及超时。如果数据在超时内在设备中不可用,则API将在超时错误中失败。然后主机需要再次调用。 或者,当设备具有数据时,可以在设备侧设置变量(标志)。主机需要对这个标志进行轮询。如果设置,主机应该调用DATATRASNFER API来接收数据。这个轮询可以通过供应商特定的安装请求来完成。主机发送特定于供应商的安装请求后,在设备中触发UBSETUP回调。在回调中,设备发送标志的状态。 当做, - Madhu Sudhan 以上来自于百度翻译 以下为原文 Hi, In USB protocol, there is no way for the USB device to send interrupt or information to the host of it's own. The Host has to ping for data. Usually the hosts call the DataTransfer APIs to get the data which is called along with a time out. If the data is not available in the device within the timeout the API will fail with timeout error. Then the host needs to call again. Or you can have a variable (flag) on the device side which is set when the device has data. The host needs to keep polling for this flag. If set, the host should call the datatrasnfer APIs to receive the data. This polling can be done though Vendor Specific Setup Requests. After the host sends vendor specific setup request, the USBSetupCallback is triggered in the device. Inside the callback the device sends the status of the flag. Regards, -Madhu Sudhan |
|
|
|
只有小组成员才能发言,加入小组>>
752个成员聚集在这个小组
加入小组2088 浏览 1 评论
1837 浏览 1 评论
3656 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1778 浏览 6 评论
1526 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
535浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
391浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
425浏览 2评论
370浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
887浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-8 11:47 , Processed in 0.714174 second(s), Total 68, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号