完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,
我使用CyUSB .NET DLL与包含FX2芯片的设备进行交互。设备连续发送数据上游通过端点6,我不断轮询从一个专门的线程来获取和处理上述数据。问题是,当我使用同步method***egindataxfer()、WaitForXfer()和FinishDataXfer()在.NET框架s抛出一个FATALRACKEngEngEngRebug异常。线程的代码显示如下: EnEP=MyCyPosix. EndPointOf(0x46)作为CyBurk终点; int bfsz=INEP.Max pktSead * 245; In Quealsz=6; BufSz。 (继续) { 字节[][CMDBUFS =新字节[QueLeSZ][]; 字节[][]XFBUFFS =新字节[QueLeSZ][]; 字节[][OVLAPs=新字节[QueReSZ][]; 不安全的 { 对于(int i=0;i & lt;QueueSz;i++) { CMDBUFS [I] =新字节[CyCONS.SUNLYXXFEYLILN ]; xFiBFF =新字节[BUFSZ]; OVLAP =新字节[Cycist.ReopApple AlalLosiScsig ]; 固定(字节*tMP0= OVLAPS [I]) { 重叠* OVLAP状态=(重叠*)TMP0; OVLAP STAtiON & GT;HEVET= pJunk.CreateEvent(0, 0, 0,0); } } In Lee=BufSz; 对于(int i=0;i & lt;QueueSz;i++) INEP。BeginDataXfer(REF cmdbufs [我],[我] xferbufs裁判,裁判长、裁判员ovlaps [我]); INT失败=0; 对于(int i=0;i & lt;QueueSz;i++) { 固定(字节*tMP0= OVLAPS [I]) { 重叠* OVLAP状态=(重叠*)TMP0; 如果(!)WaitForXfer(OVLABSTATION & GT;HEVER,500) { 中止(); PInvoke . WaitForSingleObject(ovlapstatus - >;hevent,cyconst。无限); } } 如果(INEP。FinishDataXfer(REF cmdbufs [我],[我] xferbufs裁判,裁判长、裁判员ovlaps [我])) 块(进程)(XFBUFF); 其他的 故障+ +; } } } 如果我使用同步xferdata问题消失()相反,但这种方法是不足够的带宽要求。 以上来自于百度翻译 以下为原文 Hi everyone, I'm using CyUSB .NET DLL to interact with a device that contains a FX2 chip. The device continuosly sends data upstream through endpoint 6, which I am continuosly polling from a dedicated thread to fetch and process the afore mentioned data.The problem is that when I use the synchronous methods BeginDataXfer( ), WaitForXfer( ) and FinishDataXfer( ) after a while .NET Framworks throws a FatalExecutionEngineError exception. The thread's code is shown bellow: inEP = myCyDevice.EndPointOf(0x86) as CyBulkEndPoint; int BufSz = inEP.MaxPktSize * 245; int QueueSz = 6; inEP.XferSize = BufSz; while (canContinue) { byte[][] cmdBufs = new byte[QueueSz][]; byte[][] xferBufs = new byte[QueueSz][]; byte[][] ovLaps = new byte[QueueSz][]; unsafe { for (int i = 0; i < QueueSz; i++) { cmdBufs = new byte[CyConst.SINGLE_XFER_LEN]; xferBufs = new byte[BufSz]; ovLaps = new byte[CyConst.OverlapSignalAllocSize]; fixed (byte* tmp0 = ovLaps) { OVERLAPPED* ovLapStatus = (OVERLAPPED*)tmp0; ovLapStatus->hEvent = PInvoke.CreateEvent(0, 0, 0, 0); } } int len = BufSz; for (int i = 0; i < QueueSz; i++) inEP.BeginDataXfer(ref cmdBufs, ref xferBufs, ref len, ref ovLaps); int failures = 0; for (int i = 0; i < QueueSz; i++) { fixed (byte* tmp0 = ovLaps) { OVERLAPPED* ovLapStatus = (OVERLAPPED*)tmp0; if (!inEP.WaitForXfer(ovLapStatus->hEvent, 500)) { inEP.Abort(); PInvoke.WaitForSingleObject(ovLapStatus->hEvent, CyConst.INFINITE); } } if (inEP.FinishDataXfer(ref cmdBufs, ref xferBufs, ref len, ref ovLaps)) chunks.Process(xferBufs); else failures++; } } } The problem goes away if I use synchronous XferData( ) instead, but this method is not enought for the bandwidth requirements. |
|
相关推荐
2个回答
|
|
真的吗?过了几天,连这件事都不承认?不要介意。在阅读了一个叫做“CyAPI.NETBug”的线程在这个非常相同的论坛(HTTP://www. CyPress)COM/?APP=论坛和ID;ID=167和;RID=42392),我发现了我遇到的问题的相似描述,实际上是解决问题的线索。一旦在AsiNC传输方法中使用的内存(重叠、单选符和数据缓冲区)中插入三字节[]缓冲区,它就得到了解决。
以上来自于百度翻译 以下为原文 Seriously? After several days not even an acknowledge for the case posted? Never mind. After reading the a thread called "CyAPI.NET bug" on this very same forum (http://www.cypress.com/?app=forum&id=167&rID=42392), I found a similar description for the problem I've encountered and actually the lead for solving the problem. It gets solved once you pin the three byte[] buffers in memory (Overlapped, SingleXfer, and the data buffer) used by the async transfer methods. |
|
|
|
您好!
我们遇到异步传输的类似问题。 由于CySUB异步传输的方式并不真正符合C.I标准,所以我们使用由[HTTP://www. VielalRouth.com /Byg/Dyx.Pp/77/12/08/PSoC-USB-SUITEUSB-NET-CYSUB异步-WrAPPr/]提供的CyUSB异步包装器,它对于少量的排队工作相当好。转移(& lt;10)。如果我们排队更多的转移,应用程序就会失败。 你说过你做事有条不紊。你愿意分享你的解决方案(代码)吗? 非常感谢。 以上来自于百度翻译 以下为原文 Hi We experience similar problems with asynchronous transfers. Since the way of cyu***s asynchronous transfer does not really comply with c# standards, we use the cyu*** asynchronous wrapper provided by [http://www.virtualroadside.com/blog/index.php/2007/12/08/psoc-u***-suiteu***-net-cyu***-asynchronous-wrapper/] which works fairly nice for a small amount of queued transfers (<10). If we queue more transfers the application fails. You mentioned that you got things working. Would you be willing to share your solution (code)? Thank you very much. |
|
|
|
只有小组成员才能发言,加入小组>>
752个成员聚集在这个小组
加入小组2071 浏览 1 评论
1827 浏览 1 评论
3642 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1762 浏览 6 评论
1513 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
511浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
362浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
410浏览 2评论
357浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
860浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 23:05 , Processed in 0.992099 second(s), Total 80, Slave 63 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号