- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CyU3PDmaChannelConfig_t dmaCfg;
dmaCfg.size = (usbSpeed == CY_U3P_SUPER_SPEED) ? (size * CY_FX_EP_BURST_LENGTH) : (size);
dmaCfg.count = CY_FX_BULKSRCSINK_DMA_BUF_COUNT;
dmaCfg.prodSckId = CY_FX_EP_PRODUCER_SOCKET;
dmaCfg.consSckId = CY_U3P_CPU_SOCKET_CONS;
dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT;
dmaCfg.cb = CyFxBulkSrcSinkDmaCallback;
As you can see, I can manipulate the size (where the "size" identifier in the compact "if" statement is the packet size chosen according to the USB speed) and count fields to obtain different performances. Here on the forum I read that the size of DMA buffer can grow up to 64k, but any value I replace the right side of dmaCfg.size assignment with doesn't work (it lets me compile but fails programming the device by the control center). The default value of CY_FX_BULKSRCSINK_DMA_BUF_COUNT is 8, with which I obtain a transfer rate of about 10MBps. Raising it to 252 (but not any further, cause it doesn't work) changes the transfer rate to about 14MBps.
Using the CyFxBulkLpAuto example I could reach a transfer rate of 40MBps. Can you tell me why it goes so slow, even if the transfer is one-side only?
p.s. as software application I'm using the default visual studio cpp application provided.
Thanks,
mrain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
From Cypress example code the buffer size dmaCfg.size should be equal to the USB packet size, if it is a bulk transfer then this will be 1024 in Super Speed. In your code this buffer size is equal to the packet size multiplied by the number of packets in a burst which as you say does not work - FX3 Programmers Manual for examples using size. I don't have a clear idea about the number of buffers but I think you should not need any more than twice the burst packet size so if you have 8 packets in a burst then the buffer count should be 16. Here I am assuming as you read out a burst packet from 8 of the buffers you can be filling the second set of 8.
I think the reason the firmware dosn't work when you increase the buffer count is that you have exceeded the available memory of the FX3. Total memory used by your DMA channel will be size * count.
As for transmission rate the CyFxBulkLpAuto will set up the DMA channel to operate automatically with no CPU intervention. With your example, a manual DMA channel, the CPU is involved which reduces the data rate. For fastest data rates you will need the DMA channel set to auto.
Sodafarl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your reply.
Do you know if there is a way to setup a DMA auto channel while keeping FX3 to be the producer of data?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There may be a way using the auto signalling method where the DMA channel is automatic and it signals the CPU every time it has sent or received a buffer - see chapter 7 of the Programmers Manual for more details of this, there is also a firmware example. I have not used this to generate data for the endpoint but it should be able to do so. For testing bitrate why not use the bulkloop_auto example?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mrainer,
I was wrong to say the dma buffer size should be 1024 only. I have checked this out and for fastest transfer speed the size should be at least equal to the number of packets per burst by the packet size - so for 16 packets at 1024 this will be 16K. I tried out your code to configure the buffer size and it worked.
For the number of buffers (count) I set this to 4 and I get the fastest speed .
Sodafarl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content