完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,
我正在努力了解散装汽车演示和一个应用程序之间的行为差异,我在UART RX和UBEP之间设置了一个自动DMA。 在批量自动演示中,这些字节将被循环回EP中,而马瑟则不多。在按下按钮中的传输数据之前,不需要填写DMA缓冲区。将有多达发送,没有填充(用一些分析器看)。 在我构建的示例中,在DMA缓冲区满之前,没有办法从EP中获得任何字节。这似乎是读取DOC时的正常行为,但我不能解释为什么大回环演示“似乎”不同。 我的应用是一个简单的DMA自动通道在UART(生产者)和EP1(消费者)之间,16字节双缓冲(最小),无限传输等。 对这种行为有什么合理的解释吗? 谢谢你的帮助, 马丁 以上来自于百度翻译 以下为原文 Hi, I am trying hard to understand the difference in the behavior between the bulk auto demo and one app where I set an auto dma between the uart rx and USB EP IN. In the bulk auto demo, the bytes will be looped back onto the EP IN, no mather how few of them. No need to fill the DMA buffer before hitting the transfer data-IN button. There will be as many as sent, no padding (looked with some analyzer). In the example I build, there is no way to get any bytes out of the EP before the DMA buffer is full. This seems to be the normal behavior when reading the doc, but I can not explain why the bulk loopback demo "seems" to be different. My application is a simple DMA AUTO channel between UART (producer) and EP1 (consumer), 16-byte twin buffers (the smallest), infinite transfer, etc. Any rational explanation for this behavior? Thx for any help, Martin |
|
相关推荐
4个回答
|
|
嗨,玛格伦,
也许我可以尝试帮助您更详细的代码片段信息初始化DMA和端点。UART初始化也很有意思。 当做, 隆皮 以上来自于百度翻译 以下为原文 Hi mgaron, may be I can try to help you with more detailed code snippet informations about initializing the dma and the endpoints. The uart initialization would be also interesting. regards, lumpi |
|
|
|
你好,Lumpi,谢谢你的帮助。
请看下面的代码:总之,1大块的EP,EP 1大块。(真体环回自动演示用UART物理环回) 自动DMA设置EP1和UART TX这一作品精细之间。 自动DMA是在UART RX和EP1之间设置的。除非DMA缓冲器已满,否则不进行传输。 [为了清晰起见删除了返回代码的测试] cyu3pmemset((uint8_t *)&;luartcfg,0,sizeof(luartcfg));luartcfg.baudrate = cy_u3p_uart_baudrate_115200;luartcfg.stopbit = cy_u3p_uart_one_stop_bit;luartcfg.parity = cy_u3p_uart_no_parity;luartcfg.txenable = cytrue;luartcfg.rxenable = cytrue;luartcfg.flowctrl = cyfalse;luartcfg.isdma = cytrue;lretstatus = cyu3puartinit();lretstatus = cyu3puartsetconfig(&;luartcfg,(cyu3puartintrcb_t)0);lretstatus = cyu3puarttxsetblockxfer(0xffffffffu);lretstatus = cyu3puartrxsetblockxfer(0xffffffffu);…lsize = 512;cyu3pmemset((uint8_t *)&;lepcfg,0,sizeof(lepcfg));lepcfg.enable = cytrue;lepcfg.eptype = cy_u3p_u***_ep_bulk;lepcfg.burstlen = -1;lepcfg.streams = 0;lepcfg.pcktsize = lsize;/*端点配置。* / lretstatus = cyu3psetepconfig(cy_fx_ep_producer,&;lepcfg);lretstatus = cyu3psetepconfig(cy_fx_ep_consumer,&;lepcfg);/*创建两个U口之间的DMA汽车频道。*基于USB速度设置DMA大小。* / ldmacfg.size = lsize;ldmacfg.count = pt_fx3_u3v_dma_buf_cnt;ldmacfg.prodsckid = cy_fx_ep_producer_socket;ldmacfg.conssckid = cy_u3p_lpp_socket_uart_cons;ldmacfg.dmamode = cy_u3p_dma_mode_byte;ldmacfg.notification = 0;ldmacfg.cb =(cyu3pdmacallback_t)0;ldmacfg.prodh领导= 0;ldmacfg.prodfooter = 0;ldmacfg.consheader = 0;ldmacfg.prodavailcount = 0;lretstatus = cyu3pdmachannelcreate(&;sdmachhandle [零],cy_u3p_dma_type_auto,&;ldmacfg);/*创建两个U口之间的DMA汽车频道。*基于USB速度设置DMA大小。* / ldmacfg.size = 16;/ / lsize;ldmacfg.count = pt_fx3_u3v_dma_buf_cnt;ldmacfg.prodsckid = cy_u3p_lpp_socket_uart_prod;ldmacfg.conssckid = cy_fx_ep_consumer_socket;lretstatus = cyu3pdmachannelcreate(&;sdmachhandle [1 ],cy_u3p_dma_type_auto,&;ldmacfg);/*冲洗端点记忆。* / cyu3pu***flushep(cy_fx_ep_producer);cyu3pu***flushep(cy_fx_ep_consumer);/*设置DMA通道传输大小。* / lretstatus = cyu3pdmachannelsetxfer(&;sdmachhandle [ 0 ],0);lretstatus = cyu3pdmachannelsetxfer(&;sdmachhandle [ 1 ],0);所以一切看起来很好的时候发送小数据包在终点。我看到几个字符终端是由控制中心发送。在相反的方向,我要把ldmacfg.sizebytes他们就能得到任何的端点(否则我得到错误:批量转移失败,错误代码:997)请让我知道如果你需要进一步的细节。马丁 以上来自于百度翻译 以下为原文 Hi Lumpi and thanks for offering your help. Please see the code below: In short, 1 bulk EP out, 1 bulk EP in. (It's really the bulk loopback auto demo rigged to a physical loopback on UART) AUTO DMA is set between EP 1 out and UART tx. This one works fine. AUTO DMA is set between UART Rx and EP1 in. No transfer unless the DMA buffer is full. [testing of return code removed for clarity] CyU3PMemSet((uint8_t *)&lUARTCfg, 0, sizeof(lUARTCfg)); lUARTCfg.baudRate = CY_U3P_UART_BAUDRATE_115200; lUARTCfg.stopBit = CY_U3P_UART_ONE_STOP_BIT; lUARTCfg.parity = CY_U3P_UART_NO_PARITY; lUARTCfg.txEnable = CyTrue; lUARTCfg.rxEnable = CyTrue; lUARTCfg.flowCtrl = CyFalse; lUARTCfg.isDma = CyTrue; lRetStatus = CyU3PUartInit(); lRetStatus = CyU3PUartSetConfig(&lUARTCfg, (CyU3PUartIntrCb_t)0); lRetStatus = CyU3PUartTxSetBlockXfer(0xFFFFFFFFU); lRetStatus = CyU3PUartRxSetBlockXfer(0xFFFFFFFFU); ... lSize = 512; CyU3PMemSet((uint8_t *)&lEPCfg, 0, sizeof(lEPCfg)); lEPCfg.enable = CyTrue; lEPCfg.epType = CY_U3P_USB_EP_BULK; lEPCfg.burstLen = 1; lEPCfg.streams = 0; lEPCfg.pcktSize = lSize; /* Endpoints configuration. */ lRetStatus = CyU3PSetEpConfig(CY_FX_EP_PRODUCER, &lEPCfg); lRetStatus = CyU3PSetEpConfig(CY_FX_EP_CONSUMER, &lEPCfg); /* Create a DMA Auto Channel between two sockets of the U port. * DMA size is set based on the USB speed. */ lDMACfg.size = lSize; lDMACfg.count = PT_FX3_U3V_DMA_BUF_CNT; lDMACfg.prodSckId = CY_FX_EP_PRODUCER_SOCKET; lDMACfg.consSckId = CY_U3P_LPP_SOCKET_UART_CONS; lDMACfg.dmaMode = CY_U3P_DMA_MODE_BYTE; lDMACfg.notification = 0; lDMACfg.cb = (CyU3PDmaCallback_t)0; lDMACfg.prodHeader = 0; lDMACfg.prodFooter = 0; lDMACfg.consHeader = 0; lDMACfg.prodAvailCount = 0; lRetStatus = CyU3PDmaChannelCreate(&sDMAChHandle[0], CY_U3P_DMA_TYPE_AUTO, &lDMACfg); /* Create a DMA Auto Channel between two sockets of the U port. * DMA size is set based on the USB speed. */ lDMACfg.size = 16; //lSize; lDMACfg.count = PT_FX3_U3V_DMA_BUF_CNT; lDMACfg.prodSckId = CY_U3P_LPP_SOCKET_UART_PROD; lDMACfg.consSckId = CY_FX_EP_CONSUMER_SOCKET; lRetStatus = CyU3PDmaChannelCreate(&sDMAChHandle[1], CY_U3P_DMA_TYPE_AUTO, &lDMACfg); /* Flush the Endpoint memory. */ CyU3PU***FlushEp(CY_FX_EP_PRODUCER); CyU3PU***FlushEp(CY_FX_EP_CONSUMER); /* Set DMA Channel transfer size. */ lRetStatus = CyU3PDmaChannelSetXfer(&sDMAChHandle[0], 0); lRetStatus = CyU3PDmaChannelSetXfer(&sDMAChHandle[1], 0); So everything looks fine when sending small packets on the endpoint. I see as few chars on the terminal as was sent from the control center. On the opposite direction, I need to send lDMACfg.size bytes for them to be able to get anything on the IN endpoint (Otherwise I get error: BULK IN transfer failed with Error Code:997) Please let me know if you require further details. Martin |
|
|
|
你好,
我不知道,但我想我已经听说DMA接收数据要多4个字节到DMA事件发生。你可以尝试使用手动DMA缓冲区然后检查这些事件。一个USB端点的DMA缓冲区的大小应为64字节,全速,512字节1024字节的高速和超高速。在接收情况下,您使用16字节。你改变这个了吗? 另一个办法是不是由DMA模式字节字节使用UART模式。然后安装USB端点手动通道与… cy_u3p_cpu_socket_cons = 0x3f00,/ *插座,FX3 CPU接收数据。* / cy_u3p_cpu_socket_prod / *插座,FX3 CPU产生的数据。*/ 这可以工作,但第一次尝试的uartreveice函数是否返回接收的字节数后的预期。如果还没有工作,这是有可能的是在Fx3限制uartreceive不会工作,如果它reveices较小,如4或16个字节。可以或许是后一个问题,相对于uartreceive和限制。 当做 隆皮 以上来自于百度翻译 以下为原文 Hi, I am not sure but I think I have heard about DMA receive data has to be a multiple of 4 bytes till DMA events occur. May be you try using a manual DMA buffer and then check these events. The dma buffer size of an USB endpoint should be 64 bytes for full speed, 512 bytes for high speed and 1024 bytes for super speed. You are using 16 bytes in the receive case. Have you changed this? An other solution would be using UART in byte by byte mode instead of DMA mode. And then setup your USB endpoints as manual channels with.... CY_U3P_CPU_SOCKET_CONS = 0x3F00, /* Socket through which the FX3 CPU receives data. */ CY_U3P_CPU_SOCKET_PROD /* Socket through which the FX3 CPU produces data. */ that can work, but first try the UartReveice function if it returns after receiving expected byte count. If that also not works, it is possible that there is a restriction in the FX3 that UartReceive won't work if it reveices lesser than e. g. 4 or 16 bytes. That can be may be post a question with respect to the UartReceive and restrictions. regards lumpi |
|
|
|
你好,
在FX3 SDK发布笔记是一个已知问题和解决方案与你的问题descritpion章… 7。任何UART / I2C/SPI读传输DMA模式不填满整个DMA缓冲区将不会触发DMA回调或转移完成事件。应用程序需要检查传输完成基于UART、I2C、SPI事件,然后调用cyu3pdmachannelsetwrapup() API的DMA通道。 当做 隆皮 以上来自于百度翻译 以下为原文 Hi, in the FX3 SDK release notes is a chapter with known issues and solutions with a descritpion to your issue... 7. Any UART/I2C/SPI read transfers in DMA mode that do not fill up the entire DMA buffer will not trigger a DMA callback or a transfer complete event. The application needs to check for transfer completion based on the UART/I2C/SPI events and then invoke the CyU3PDmaChannelSetWrapUp() API on the DMA channel. regards lumpi |
|
|
|
只有小组成员才能发言,加入小组>>
754个成员聚集在这个小组
加入小组2101 浏览 1 评论
1848 浏览 1 评论
3666 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1783 浏览 6 评论
1533 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
564浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
418浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
434浏览 2评论
380浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
909浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-21 11:39 , Processed in 1.146474 second(s), Total 82, Slave 66 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号