2 Replies Latest reply on Mar 24, 2017 8:34 PM by zmhusthust_1501731

    transfer for 2Mbytes image data stream per frame continuoulsy



      Our camera hardware is based on cy68013A usb2.0 controller. I am using CyAPI(1.3) to develop win10 camera software. We are using bulk transfer.


      My transfer code transplanted from your bulkloop example. When I receive 1280 * 960 * 2 bytes from the hardware, the buffer in the hardware will always overflow resulting in I can't receive the frame data correctly. In this case, I'am using packetSize = 1024, packetNum = 1280 * 960 * 2 / 1024, transferQueueSize = 1 with the funcions BeginDataXfer/WaitForXfer/FinishDataXfer. However, if I increase transferQueueSize and decrease the packetNum, The data transfer will be more efficiently and in some values of the two, we will receive the data normally. Our speed is up to 35Mbytes/s.


      So why do the different packetNum and transferQueueSize lead to different efficiency of receiving data? And what's the thing does BegingDataXfer/WaitForXfer/FinishDataXfer separately? The last question is where to reflect the transfer asynchronization.


      Thank you.

        • 1. Re: transfer for 2Mbytes image data stream per frame continuoulsy



          Here is the relation between packetNum/transferQueueSize to the datarate.


          When you use BeginDataXfer/WaitforXfer/FinishDataXfer the transfer is called Asynchronuos transfer meaning you can queue up multiple transfers simultaneously. Specifically if you queue 10 transfers the Begin of all the 10 transfers is called and each transfer goes to wait state. Once the data requested in the first begin is received, corresponding wait is signalled. Once this is done the next transfer is begun which is the second wait state. While the second transfer is happening, the first transfer is in the Finish state. Once the data received in the first transfer is received by the application the buffers are returned back and it's next Begin gets called.


          The other type of transfer is Synchronous transfer where one transfer enters Begin state, Waits for the data requested and then once the data is received/timeout occurs it enters Finish state. One after this Finish, Next begin happens(next transfer begins).


          If you are putting the transferQueueSize as 1, then it would be same as Synchronous transfer and you would not be getting the datarate as would have been obtained in the Asynchronous transfer.


          So, you can incerase the transferQueue size but need not decrease the packets per Xfer.


          Hope the above explanation is clear.


          One question regarding the case description is:


          It is mentioned that the packet size is 1024 bytes and the transfer is of type BULK. Since in 2.0 the maxPacketSize is 512 bytes, how is it mentioned as 1024 bytes?





          • 2. Re: transfer for 2Mbytes image data stream per frame continuoulsy

            Hi, Hemanth


            Thank you for answers.


            For your question about packet size. Because our firmware developer found 1024bytes might make transfer speed faster. But I think we should refer to the standard and make the packet size 512bytes. However, whenever it's 512bytes or 1024bytes, the buffer often overflow in the speed of 35Mbytes/s.


            So my question is how to improve the buffer overflow. And is there a recommended value for packetNums and transferQueue size if our packet size is 512bytes?