CyU3PDmaChannelSetXfer

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

cross mob
Anonymous
Not applicable

Hi !

In the cyfxbulklpauto.c of AN87216 - Designing a GPIF II Master Interface,there is a CyU3PDmaChannelSetXfer.

In the

CyFxBulkLpApplnStart (

        void)

222222.PNG

UtoP and PtoU all been set.

But in the

CyFxBulkLpApplnUSBSetupCB (

        uint32_t setupdat0, /* SETUP Data 0 */

        uint32_t setupdat1  /* SETUP Data 1 */

    )

why it doesn't be used to  CyU3PDmaChannelSetXfer(glChHandleBulkLpPtoU,CY_FX_DMA_TX_SIZE)and CyU3PDmaChannelReset(&glChHandleBulkLpPtoU) did not  be set either.

1111111.PNG

0 Likes
1 Solution
alamandaa_16
Moderator
Moderator
Moderator
10 likes received First like received

Thank you so much for pointing this error in this App Note Code. We will update it in next version of the App Note.

This snippet supposed to be following. We should reset the DMA Channel, Flush and RESET the endpoints based on the consumer and producer separately.

if ((bTarget == CY_U3P_USB_TARGET_ENDPT) && (bRequest == CY_U3P_USB_SC_CLEAR_FEATURE)

                && (wValue == CY_U3P_USBX_FS_EP_HALT))

        {

            if ((wIndex == CY_FX_EP_PRODUCER))

            {

                if (glIsApplnActive)

                {

                    CyU3PUsbSetEpNak (CY_FX_EP_PRODUCER, CyTrue);

                     CyU3PBusyWait (125);

                    CyU3PDmaChannelReset (&glChHandleBulkLpUtoP);

                    CyU3PUsbFlushEp(CY_FX_EP_PRODUCER);

                    CyU3PUsbResetEp (CY_FX_EP_PRODUCER);

                    CyU3PDmaChannelSetXfer (&glChHandleBulkLpUtoP, CY_FX_DMA_TX_SIZE);

                    CyU3PUsbStall (wIndex, CyFalse, CyTrue);

                   CyU3PUsbSetEpNak (CY_FX_EP_PRODUCER, CyFalse);

                    isHandled = CyTrue;

                    CyU3PUsbAckSetup ();

                }

            }

           if ((wIndex == CY_FX_EP_CONSUMER))

            {

                if (glIsApplnActive)

                {

                    CyU3PUsbSetEpNak (CY_FX_EP_CONSUMER, CyTrue);

                     CyU3PBusyWait (125);

                    CyU3PDmaChannelReset (&glChHandleBulkLpPtoU);

                    CyU3PUsbFlushEp(CY_FX_EP_CONSUMER);

                    CyU3PUsbResetEp (CY_FX_EP_CONSUMER);

                    CyU3PDmaChannelSetXfer (&glChHandleBulkLpPtoU, CY_FX_DMA_TX_SIZE);

                    CyU3PUsbStall (wIndex, CyFalse, CyTrue);

                   CyU3PUsbSetEpNak (CY_FX_EP_CONSUMER, CyFalse);

                    isHandled = CyTrue;

                    CyU3PUsbAckSetup ();

                }

            }

     }

View solution in original post

0 Likes
1 Reply
alamandaa_16
Moderator
Moderator
Moderator
10 likes received First like received

Thank you so much for pointing this error in this App Note Code. We will update it in next version of the App Note.

This snippet supposed to be following. We should reset the DMA Channel, Flush and RESET the endpoints based on the consumer and producer separately.

if ((bTarget == CY_U3P_USB_TARGET_ENDPT) && (bRequest == CY_U3P_USB_SC_CLEAR_FEATURE)

                && (wValue == CY_U3P_USBX_FS_EP_HALT))

        {

            if ((wIndex == CY_FX_EP_PRODUCER))

            {

                if (glIsApplnActive)

                {

                    CyU3PUsbSetEpNak (CY_FX_EP_PRODUCER, CyTrue);

                     CyU3PBusyWait (125);

                    CyU3PDmaChannelReset (&glChHandleBulkLpUtoP);

                    CyU3PUsbFlushEp(CY_FX_EP_PRODUCER);

                    CyU3PUsbResetEp (CY_FX_EP_PRODUCER);

                    CyU3PDmaChannelSetXfer (&glChHandleBulkLpUtoP, CY_FX_DMA_TX_SIZE);

                    CyU3PUsbStall (wIndex, CyFalse, CyTrue);

                   CyU3PUsbSetEpNak (CY_FX_EP_PRODUCER, CyFalse);

                    isHandled = CyTrue;

                    CyU3PUsbAckSetup ();

                }

            }

           if ((wIndex == CY_FX_EP_CONSUMER))

            {

                if (glIsApplnActive)

                {

                    CyU3PUsbSetEpNak (CY_FX_EP_CONSUMER, CyTrue);

                     CyU3PBusyWait (125);

                    CyU3PDmaChannelReset (&glChHandleBulkLpPtoU);

                    CyU3PUsbFlushEp(CY_FX_EP_CONSUMER);

                    CyU3PUsbResetEp (CY_FX_EP_CONSUMER);

                    CyU3PDmaChannelSetXfer (&glChHandleBulkLpPtoU, CY_FX_DMA_TX_SIZE);

                    CyU3PUsbStall (wIndex, CyFalse, CyTrue);

                   CyU3PUsbSetEpNak (CY_FX_EP_CONSUMER, CyFalse);

                    isHandled = CyTrue;

                    CyU3PUsbAckSetup ();

                }

            }

     }

0 Likes