5 Replies Latest reply on May 24, 2012 5:18 AM by dhanraj.rajput

    FX3 transmission rate

          Hi everybody,   
           I'm trying to get started in development on the FX3 board by learning from the firmware examples provided. I want the FX3 to generate some data and to send it via USB to my computer. I don't care about what to do with this data, for now my interest is to see the transfer bitrate. In the CyFxBulkSrcSink example a pair of IN/OUT endpoint is set (EP1 default, but I switched to EP6 in order to have higher bandwith), then a DMA MANUAL IN channel is created for data sink and a DMA MANUAL OUT channel is created for data source. A constant data pattern is continuously loaded into the DMA MANUAL OUT      channel and sent to the host.   
          The code to set the parameters to create the DMA MANUAL channel is the following:   

      CyU3PDmaChannelConfig_t dmaCfg;


      dmaCfg.size  = (usbSpeed == CY_U3P_SUPER_SPEED) ? (size * CY_FX_EP_BURST_LENGTH) : (size);






      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.







        • 1. Re: FX3 transmission rate



          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.



          • 2. Re: FX3 transmission rate

             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?

            • 3. Re: FX3 transmission rate

              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?

              • 4. Re: FX3 transmission rate



                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 .



                • 5. Re: FX3 transmission rate



                  are you using SDK 1.1? there is readme.txt file located in "C:\Cypress\EZ-USB FX3 SDK\1.1\firmware\basic_examples\cyfxisosrcsink", it has instruction to set high performance application.