完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正面临一个问题,我正在为这个PIC写一个堆栈。测试代码当前定义了三个端点;EP0在EP0 OUT和EP1中。除了EP0以外,我用乒乓球在所有的EPS上。堆栈枚举完美(至少在Linux上)。USB处理是在低优先级ISR上完成的。端点0除了标准请求之外,还处理一些自定义请求来控制HW。端点1被设置为EP中的一个块,具有64字节缓冲器(2,如乒乓),捕获一些引脚状态并将其写入EP缓冲器。基本代码。测试代码进入一个循环,试图写入EP缓冲区并将其安排到SIE中。同样,非常基本的东西。我的问题发生在前两个缓冲区(偶数和奇数)被发送,一个在DATA0包中,另一个在DATA1中。一旦两者被发送,SIE在DATA0包上发送第三个缓冲器,从主机接收ACK,但显然忽略它,因为它不释放BD,并且只保留重新发送T。同样的数据,一遍又一遍。我把UUND、DTSN和DTS的状态都放在循环中的缓冲器上,我可以看到,这两个缓冲器最终都被安排到SIE(UWITE位集、DTSN位集和DTS位置奇数和偶数重置)上,并保持这种方式,同时SIE重新发送相同的数据。被捕获的硬件逻辑分析仪连接到UC附近,所以我不认为UC可能误读ACK包。我期待着对SIE做点什么,让它困惑,但是什么?在更新BDS之前,代码专门检查UWORE=0,但它可以在任何时间读取它们,因为它轮询它们的状态。但这应该是安全的。该部分不是A3版本,所以它不是“PP上所有的,但EP0”的问题。任何想法,什么可能导致SIE继续重新发送相同的缓冲区,而不释放它,尽管ACKs从主机?
以上来自于百度翻译 以下为原文 I'm faced with an issue on a stack I'm writing for this PIC. The test code currently defines three endpoins; EP0 IN, EP0 OUT and EP1 IN. I'm using ping-pong on all EPs except EP0. The stack enumerates perfectly (well, at least on Linux). The USB handling is done on a low priority ISR. Endpoint 0, apart from the standard requests, handles some custom requests to control the HW. Those work perfectly. Endpoint 1 is setup as a Bulk IN EP with 64 byte buffers (2, as per ping-pong), that captures some pins states and writes it on the EP buffers. Basic stuff. The test code goes into a loop trying to write into an EP buffer and scheduling it into the SIE as soon as its full. Again, pretty basic stuff. My problem happens after the first two buffers (Even and Odd) are sent, one in a DATA0 packet and the other in a DATA1. Once both are sent the SIE sends a third buffer on a DATA0 packet, receives an ACK from the host but apparently ignores it as it does not releases the BD and just keeps resending the same data, over and over. I'm dumping the state of the UOWN, DTSEN and DTS on both IN buffers on the loop and I can see that eventually both buffers are scheduled into the SIE (UOWN bits set, DTSEN bits set and DTS bits set on Odd and reset on Even) and remain this way while the SIE resends the same data. The USB traffic is being captured with an hardware logic analyzer hooked up close to the uC so I don't think its possible for the uC to be misreading the ACK packet. I expect to be doing something to the SIE that is confusing it, but what ? The code specifically checks UOWN=0 before updating the BDs but it can read them at any time, since its polling their state. But this is supposed to be safe. The part is not an A3 revision so it's not the 'PP on all but EP0' issue. Any thoughs on what could cause the SIE to keep resending the same buffer, without releasing it, despite getting ACKs from the host ? |
|
相关推荐
2个回答
|
|
我相信我发现了这个问题,一个代码错误加上PIC的一个有趣的响应。在将BDS安排到SIE I的代码中,事先没有清除BSTALL位。因此,BDS,首先,BSTALL位明确,并按照广告工作。但是一旦它们被SIE释放,PID的0位将重写BSTALL位(BDNSTAT上的那个比特是双任务的,正确地记录)。有趣的响应显然是由于DTSN也设置的;因此SIE而不是从主机的令牌上回复STORE,将。用偶数缓冲区内容发送一个DATA0,但考虑到BSTALL的设置,它不会释放BD,也不会翻转乒乓球内部指针。
以上来自于百度翻译 以下为原文 I believe I found the issue, a code error coupled with an interesting response from the PIC. On the code that scheduled the BDs into the SIE I was not clearing the BSTALL bit beforehand. So the BDs, at first, had the BSTALL bit clear and worked as advertised. But once they were released by the SIE the bit 0 of the PID would overwrite the BSTALL bit (that bit on BDnSTAT does double duty, properly documented). The interesting response apparently was caused by having DTSEN also set; so the SIE instead of replying STALL on the IN tokens from the host, would send a DATA0 with the Even buffer contents but, given that BSTALL was set, would not release the BD nor flip the ping-pong internal pointer. |
|
|
|
在进一步审查代码时,BSTALL被屏蔽了。未被屏蔽的是BDNSTAT的比特4和5,当调度BD时应该被重置,但是当从SIE释放BD时,IN令牌(1001)的PID被设置(特别是比特5)。
以上来自于百度翻译 以下为原文 Upon further review of the code, the BSTALL was being masked out. What was not masked out were bits 4 and 5 of BDnSTAT, which are supposed to be reset when scheduling the BD but were being set (particularly bit 5) by the PID of the IN token (1001) upon BD release from the SIE. |
|
|
|
只有小组成员才能发言,加入小组>>
5184 浏览 9 评论
2005 浏览 8 评论
1932 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3179 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2230 浏览 5 评论
742浏览 1评论
629浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
512浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
641浏览 0评论
538浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-29 09:02 , Processed in 1.357580 second(s), Total 81, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号