- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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