Bulkloop Example - Transfer Data Between EP Issue

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

cross mob
HuYa_4249091
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

Hi , I installed EZ-USB FX3 v1.3.4 and want to use bulkloop example to understand the transmission mechanism by BULK endpoint between FX3 & PC.

FW: .\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxbulklpautoenum

SW: .\Cypress\EZ-USB FX3 SDK\1.3\application\cpp\bulkloop

It's work to run the example, and I figure out the transfer mechanism by studying the code:

Step1. PC send the constant size data to the FX3 by bulk-out ep

Step2. FX3 transfer the data (received from Bulk OUT ep) to bulk-in ep, and send back to PC

Step3. PC compares the IN & OUT ep buffer to judge the transmission result

I know it uses DMA auto mode for data buffer, which means the CPU is not involved in the data transfer.

Therefore, I don't find any code in the FW project "cyfxbulklpautoenum" to process the bulk ep data.

In this case, how to achieve the Step2 by FW?

Thank you

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

There is a DMA channel declaration at cyfxbulklpautoenum.c(189) as follows.

    /* Create a DMA Auto Channel between two sockets of the U port.

     * DMA size is set based on the USB speed. */

    dmaCfg.size           = size;

    dmaCfg.count          = CY_FX_BULKLP_DMA_BUF_COUNT;

    dmaCfg.prodSckId      = CY_FX_EP_PRODUCER_SOCKET;

    dmaCfg.consSckId      = CY_FX_EP_CONSUMER_SOCKET;

    dmaCfg.dmaMode        = CY_U3P_DMA_MODE_BYTE;

    dmaCfg.notification   = 0;

    dmaCfg.cb             = NULL;

    dmaCfg.prodHeader     = 0;

    dmaCfg.prodFooter     = 0;

    dmaCfg.consHeader     = 0;

    dmaCfg.prodAvailCount = 0;

    apiRetStatus = CyU3PDmaChannelCreate (&glChHandleBulkLp,

            CY_U3P_DMA_TYPE_AUTO, &dmaCfg);

This DMA channel is invoked when a packet is arrived at the PRODUCER socket and sends the packet to the CONSUMER socket.  This transfer is automatically executed and you don't need to write any firmware to transfer the packet

Please refer "5.2.5 DMA Engine" in the "FX3 Programmers Manual" document which is installed with the EZ USB Suite.

GS004695.png

Regards,

Noriaki

View solution in original post

3 Replies
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

There is a DMA channel declaration at cyfxbulklpautoenum.c(189) as follows.

    /* Create a DMA Auto Channel between two sockets of the U port.

     * DMA size is set based on the USB speed. */

    dmaCfg.size           = size;

    dmaCfg.count          = CY_FX_BULKLP_DMA_BUF_COUNT;

    dmaCfg.prodSckId      = CY_FX_EP_PRODUCER_SOCKET;

    dmaCfg.consSckId      = CY_FX_EP_CONSUMER_SOCKET;

    dmaCfg.dmaMode        = CY_U3P_DMA_MODE_BYTE;

    dmaCfg.notification   = 0;

    dmaCfg.cb             = NULL;

    dmaCfg.prodHeader     = 0;

    dmaCfg.prodFooter     = 0;

    dmaCfg.consHeader     = 0;

    dmaCfg.prodAvailCount = 0;

    apiRetStatus = CyU3PDmaChannelCreate (&glChHandleBulkLp,

            CY_U3P_DMA_TYPE_AUTO, &dmaCfg);

This DMA channel is invoked when a packet is arrived at the PRODUCER socket and sends the packet to the CONSUMER socket.  This transfer is automatically executed and you don't need to write any firmware to transfer the packet

Please refer "5.2.5 DMA Engine" in the "FX3 Programmers Manual" document which is installed with the EZ USB Suite.

GS004695.png

Regards,

Noriaki

Dear Noriaki:

Thanks for your expert reply!

I've studied the section which you mentioned, and understood that both producer & consumer socket use SAME buffer, so:

(1) The bulk-in endpoint just take the data on buffer which is put by bulk-out endpoint, is it right?

(2) In addition, in this example, DMA auto mode, it's impossible to modify the data which is received by bulk-out endpoint without  using GPIFII, right?

Best regards,

Hughes

0 Likes

Hughes,

(Q1) The bulk-in endpoint just take the data on buffer which is put by bulk-out endpoint, is it right?

Yes, the DMA auto mode just transfer a packet from the producer (bulk out) to the consumer (bulk in).

(Q2) In addition, in this example, DMA auto mode, it's impossible to modify the data which is received by bulk-out endpoint without  using GPIFII, right?

Regardless of the GPIF II usage, the received packet cannot be modified in DMA auto mode.

If you want to modify the data packet received from the producer, you must use the Manual Channel.

GS004696.png

In the Manual Channel configuration, the CPU (firmware) is notified when a packet is received from the producer.  The firmware can modify the data packet and send it to the consumer using an API.  Please refer USBBulkLoopManual (cyfxbulklpmanual) example.

Regards,

Noriaki