完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我用C++ WiUSB库与APIC18LF45 50进行通信。我们设计固件的方式,我们每200个传感器测量一个传感器,最多三个测量被捆绑成一个64字节的批量传输包,并使用WiuSbBiRead Pipe()发送到主机。因此,我需要至少每隔600个发送一个读请求,以避免落后于测量数据。在当前代码中,我有一个专用线程,它不断地请求数据包,并将它们转储到队列中进行后期处理。在Windows 8和10上,这工作很漂亮,通过循环的平均时间大约是200美元。在运行Windows 7的机器上,我读到了大约1ms的读取请求的硬限制。在其他线程中通常给出的建议是使用重叠结构设置多个异步读线程,但这并没有帮助。我相信我已经确认了这是一个与OS有关的问题(例如,它不是处理器时钟速度,或者与USB端口硬件有关的问题,或者我可以通过调整软件来解决的问题),通过安装一个带有Windows 7的笔记本电脑,产生问题,然后将笔记本电脑升级到Windows。8,看着这个问题消失。我的怀疑是它与框架(Windows 8和10使用125个美国微微公司与Windows 7使用1毫秒帧)有关,但是设备枚举为USB 1.1全速设备在每个OS上。如果这是个问题,我应该看到每一个环境都有1毫秒的限制。甚至可能吗?
以上来自于百度翻译 以下为原文 I'm communicating with a PIC18LF4550 using the C++ WinUSB library. The way we have our firmware designed, we take a measurement off of a sensor every 200 uS, up to three measurements are bundled into a 64 byte bulk transfer packet, and sent to the host machine using WinU***_ReadPipe(). As a result, I need to send a read request at least every 600 uS to avoid falling behind on measurement data. In the current code, I've got a dedicated thread that constantly requests packets, and dumps them into a Queue for later processing. On Windows 8 and 10, this works beautifully, the average time through the loop is around 200 uS. On machines running Windows 7, I'm running into a hard limit of around 1mS for read requests. The usual advice given in other threads has been to set up multiple asynchronous read threads using the overlapping structure, but this hasn't helped. I believe I've confirmed it's an issue specifically with the OS (e.g. it's not processor clock speed or an issue with the USB port hardware, or something I can fix by tweaking the software) by taking a laptop with Windows 7 installed on it, producing the issue, then upgrading the laptop to Windows 8, and watching the issue go away. My suspicion is that it has something to do with framing (Windows 8 and 10 using 125 uS microframes vs. Windows 7 using 1 ms frames), but the device enumerates as a USB 1.1 Full Speed device on every OS. If this were the issue, I should be seeing the hard 1 ms limit in every environment. Any thoughts about how to fix this? Is it even possible? |
|
相关推荐
1个回答
|
|
一个问题是:如果你发送65字节,它需要2字节的包,你发送63字节,它需要1字节,你发送64字节,它需要2个数据包,一个64字节的数据包,然后是一个零长度的数据包来表示结束。所有USB 2高速设备使用125US帧,但是你的设备是2全速。使用1ms框架。
以上来自于百度翻译 以下为原文 Well, one issue is: If you send 65 bytes it take 2 packets if you send 63 bytes it takes 1 packet if you send 64 bytes it takes 2 packets, one 64 byte packet and then a zero length packet to signify the end. all USB 2.0 high speed devices use the 125us framing, but your device is a 2.0 full speed which used 1ms framing. |
|
|
|
只有小组成员才能发言,加入小组>>
5275 浏览 9 评论
2048 浏览 8 评论
1962 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3225 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2272 浏览 5 评论
807浏览 1评论
702浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
636浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
696浏览 0评论
592浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-1-6 14:24 , Processed in 1.187115 second(s), Total 77, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号