4 Replies Latest reply on Sep 24, 2018 12:15 AM by hman

    FX3 - Receive wrong data when using multi dma channel

    dong_yuan_3129401

      I'm using FX3 to transfer data from FPGA to USB host via GPIF and encounter some problems with data transfer.

      Hope someone could tell me what to do to identify the cause or give me any advice to prevent the situation.

       

       

      I use a two-socket DMA channel with AUTO_MANY_TO_ONE type and every address has 6 16-KB buffer.

      Input are address 0 and 1 of GPIF and output is usb port.

      GPIF is configured for 32-bit data buses and input clock is 99MHz.

       

       

      After data transferring for a while, data packets received by PC and hardware USB analyzer  would be wrong .

      The length of the time before it happens is random.

      Once the data is wrong, the situation would last.

       

       

      The following are 2 situations of wrong data.

       

      1.Input data at address 0 of GPIF :55 33 56 4C 00 00 34 00 22 E8 00 00……

        but data that hardware USB analyzer and USB host receive become

            75 75 76 76 77 77 78 78 00 00 70 68 55 33 56 4C 00 00 34 00 22 E8 00 00 …

       

        There are some unknown data appearing in the front of the data I input.

       

        I have checked every byte of dma buffer memory continuously to see if unique header "55 33 56 4C" is written at wrong memory address.

        But the header data are always written at the head of every dma buffer without offset and unexpected data.

       

      2.The order of data I sent to GPIF was

      address 0  data A

      address 1  data B

      address 0  data C

       

      but the order of data received by USB analyzer is NOT data A ->B ->C

       

      Configuration of Dma channel and GPIF

      muldmaCfg.size = (16 * 1024);

      muldmaCfg.count = 6;

      muldmaCfg.validSckCount = 2;

      muldmaCfg.prodSckId[0] = (CyU3PDmaSocketId_t)CY_U3P_PIB_SOCKET_0;

      muldmaCfg.prodSckId[1] = (CyU3PDmaSocketId_t)CY_U3P_PIB_SOCKET_1;

      muldmaCfg.consSckId[0] = (CyU3PDmaSocketId_t)(CY_U3P_UIB_SOCKET_CONS_3);

      muldmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;

      muldmaCfg.notification = 0;

      muldmaCfg.cb = 0;

      muldmaCfg.prodHeader = 0;

      muldmaCfg.prodFooter = 0;

      muldmaCfg.consHeader = 0;

      muldmaCfg.prodAvailCount   = 0;

       

      CyU3PDmaMultiChannelCreate(&G_DmaChHandle, CY_U3P_DMA_TYPE_AUTO_MANY_TO_ONE, &muldmaCfg);

      CyU3PDmaMultiChannelSetXfer(&G_DmaChHandle, 0, 0);

       

      pibClock.clkDiv = 2;

      pibClock.clkSrc = CY_U3P_SYS_CLK;

      pibClock.isHalfDiv   = CyFalse;

      pibClock.isDllEnable= CyFalse;

       

      CyU3PPibInit(CyTrue, &pibClock);

      CyU3PGpifLoad(&CyFxGpifConfig);

      CyU3PGpifSocketConfigure(0, CY_U3P_PIB_SOCKET_0, 6, CyFalse, 1);

      CyU3PGpifSocketConfigure(1, CY_U3P_PIB_SOCKET_1, 6, CyFalse, 1);

      CyU3PGpifSMStart(RESET, ALPHA_RESET);

      GPIF state machine:

      22.jpg