2 Replies Latest reply on Aug 12, 2013 7:04 AM by gaya

    GPIF, state machine, DR_DATA

    albert.yakupov

      Dear Sirs,
      I create DMA auto channel usb-out to P-port (see code below) and bind it to socket_1.
      And I create GPIF II State Machine. It drives a data and WRITE signal.
      Dma channel has 16 buffers. Size of each buffer is 1024 bytes.
      I can transfer data-out of any size only 16 times. Thereafter all 16 buffers are filled (see statemachine1.cydsn.zip).
      DR_DATA drives only first 4 bytes of first data-out.

         

      ------CODE-----

      void ApplnStart (void)
      {
        /* endpoint config */
        CyU3PEpConfig_t epCfg;
        CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg));
        epCfg.enable = CyTrue;
        epCfg.epType = CY_U3P_USB_EP_BULK;
        epCfg.burstLen = 1;
        epCfg.streams = 0;
        epCfg.pcktSize = size;
        CyU3PSetEpConfig(0x02, &epCfg);

        /* dma config */
        dmaCfg.size  = 1024;
        dmaCfg.count = 16;
        dmaCfg.prodSckId = CY_U3P_UIB_SOCKET_PROD_2;
        dmaCfg.consSckId = CY_U3P_PIB_SOCKET_1;
        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;

        /* create channel */
        CyU3PDmaChannel handle;
        CyU3PDmaChannelCreate (&handle, CY_U3P_DMA_TYPE_AUTO, &dmaCfg);
        CyU3PUsbFlushEp(0x02);
        CyU3PDmaChannelSetXfer (&handle, CY_FX_DMA_TX_SIZE);
      }

      void
      CyFxBulkLpApplnInit (void)
      {
        CyU3PGpifSocketConfigure(0, CY_U3P_PIB_SOCKET_1, 1, CyFalse, 1);
        apiRetStatus = CyU3PGpifSMStart (START, ALPHA_START);
        ...
      }