USB streamerexample device minimum transfer size

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
GuTa_4286841
Level 1
Level 1

In Cypress USB streamer example, when I use USB control center, select bulkin endpoint, then data transfer, transfer data in, for bytes to transfer, anything that is not a multiple of 1024 will result in

BULK IN transfer

BULK IN transfer failed with Error Code:997

For my own application, I want to do register read/write via USB to FPGA device in addition to streaming large amount of data. Is it possible to read/write data in multiple of 2*int32, instead of always asking for n*1024 bytes?

If that is not possible, what's the alternative solution? Can I create another two end points, that has maximum package size set to 8 bytes?

Thanks,

0 Likes
1 Solution
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

USB Bulk-in transfer can support any size of packets within the size of burst packets.

I understand you are using an FX3 example project supporting the Cypress USB streamer application.

I will use the USBBulkSourceSink (basic_example\cyfxbulksrcsink)

To make an 8-Byte packet at the FX3 firmware, Modify the CyFxBulkSrcSinkDmaCallback() function as follows.

    if (type == CY_U3P_DMA_CB_CONS_EVENT)

    {

        /* This is a consume event notification to the CPU. This notification is

         * received when a buffer is sent out from the device. We have to commit

         * a new buffer as soon as a buffer is available to implement the data

         * source. The data is preloaded into the buffer at that start. So just

         * commit the buffer. */

        status = CyU3PDmaChannelGetBuffer (chHandle, &buf_p, CYU3P_NO_WAIT);

        if (status == CY_U3P_SUCCESS)

        {

            /* Commit the full buffer with default status. */

            status = CyU3PDmaChannelCommitBuffer (chHandle, 8 /*buf_p.size*/, 0);

            if (status != CY_U3P_SUCCESS)

            {

                CyU3PDebugPrint (4, "CyU3PDmaChannelCommitBuffer failed, Error code = %d\n", status);

            }

        }

        else

        {

            CyU3PDebugPrint (4, "CyU3PDmaChannelGetBuffer failed, Error code = %d\n", status);

        }

        /* Increment the counter. */

        glDMATxCount++;

    }

Just change the second argument of the function call CyU3PDmaChannelCommitBuffer()

When you click the "Transfer Data-In" button you can see an 8-Byte packet is sent from FX3.

GS004297.png

Please note that you will see six 16kB packets at first which is filled by the function CyFxBulkSrcSinkFillInBuffers()

Regards,

Noriaki

View solution in original post

0 Likes
2 Replies
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

USB Bulk-in transfer can support any size of packets within the size of burst packets.

I understand you are using an FX3 example project supporting the Cypress USB streamer application.

I will use the USBBulkSourceSink (basic_example\cyfxbulksrcsink)

To make an 8-Byte packet at the FX3 firmware, Modify the CyFxBulkSrcSinkDmaCallback() function as follows.

    if (type == CY_U3P_DMA_CB_CONS_EVENT)

    {

        /* This is a consume event notification to the CPU. This notification is

         * received when a buffer is sent out from the device. We have to commit

         * a new buffer as soon as a buffer is available to implement the data

         * source. The data is preloaded into the buffer at that start. So just

         * commit the buffer. */

        status = CyU3PDmaChannelGetBuffer (chHandle, &buf_p, CYU3P_NO_WAIT);

        if (status == CY_U3P_SUCCESS)

        {

            /* Commit the full buffer with default status. */

            status = CyU3PDmaChannelCommitBuffer (chHandle, 8 /*buf_p.size*/, 0);

            if (status != CY_U3P_SUCCESS)

            {

                CyU3PDebugPrint (4, "CyU3PDmaChannelCommitBuffer failed, Error code = %d\n", status);

            }

        }

        else

        {

            CyU3PDebugPrint (4, "CyU3PDmaChannelGetBuffer failed, Error code = %d\n", status);

        }

        /* Increment the counter. */

        glDMATxCount++;

    }

Just change the second argument of the function call CyU3PDmaChannelCommitBuffer()

When you click the "Transfer Data-In" button you can see an 8-Byte packet is sent from FX3.

GS004297.png

Please note that you will see six 16kB packets at first which is filled by the function CyFxBulkSrcSinkFillInBuffers()

Regards,

Noriaki

0 Likes

Noriaki,

Thank you very much!

I will try it out next week.

Regards,

Guo

0 Likes