8 Replies Latest reply on Aug 17, 2018 3:24 AM by srnt

    How to read one 16 bit data word via GPIFII and send?

    ievgenrai_2610591

      I have simple scheme (see pic.) FX3 read 16 bit data from slave FPGA with embedded registers array.

      scheme.jpg

       

      I have made GPIF State Machine with GPIF designer (see pic.)

       

      Новый точечный рисунок (3).jpg

       

      st1.jpg

      GPIF State Machine starts from state "START" and then I switch to state "RD_START" in Entry function SRamAppThread_Entry  using CyU3PGpifSMSwitch (256, RD_START, 256, 0, 0);

       

      In STATE6 is called interrupt callback function with code:

        {

                CyU3PDmaChannelSetWrapUp(&glChHandleSRamPtoU_48);  

          }

       

       

      for (;

          {

               // code before

                apiRetStatus = CyU3PGpifSMSwitch (256, RD_START, 256, 0, 0);

                if(apiRetStatus != CY_U3P_SUCCESS){

                CyU3PDebugPrint (CY_FX_DEBUG_PRIORITY, "CyU3PGpifSMSwitch failed, Error code = %d\r\n", apiRetStatus);

               }

                // code after

           }

       

      breakpoint set apiRetStatus = CyU3PGpifSMSwitch (256, RD_START, 256, 0, 0);

       

      I want to read one 16 bit word, but I have "zero length" in Control Center window. When I try to read 2 words  I haven't problem and I receive 2 words.

      I cant read odd number of words. If I try to read odd number of words - N, I have N-1 words (even numer of words).

       

      Were is my mistake

       

      P.S.

       

      /*------DMA P-Port config (AUTO mode)---------------------------------------------------------------------------------------------*/

      dmaCfg.notification = 0;

      dmaCfg.cb = NULL;

      dmaCfg.prodSckId = CY_FX_PRODUCER_USB_SOCKET_4;

      dmaCfg.consSckId = CY_FX_CONSUMER_PPORT_SOCKET;

      dmaCfg.count = 1;

       

      apiRetStatus = CyU3PDmaChannelCreate (&glChHandleSRamUtoP_48, CY_U3P_DMA_TYPE_AUTO, &dmaCfg);

      if (apiRetStatus != CY_U3P_SUCCESS)

      {

         CyU3PDebugPrint (CY_FX_DEBUG_PRIORITY, "CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus);

         CyFxAppErrorHandler(apiRetStatus);

      }

       

      dmaCfg.notification = 0;

      dmaCfg.cb = NULL;

      dmaCfg.prodSckId = CY_FX_PRODUCER_PPORT_SOCKET;

      dmaCfg.consSckId = CY_FX_CONSUMER_USB_SOCKET_8;

      dmaCfg.count = 1;

       

      apiRetStatus = CyU3PDmaChannelCreate (&glChHandleSRamPtoU_48, CY_U3P_DMA_TYPE_AUTO, &dmaCfg);

      if (apiRetStatus != CY_U3P_SUCCESS)

      {

         CyU3PDebugPrint (CY_FX_DEBUG_PRIORITY, "CyU3PDmaChannelconfig Failed, Error code = %d\n", apiRetStatus);

         CyFxAppErrorHandler(apiRetStatus);

      }

      /*-------------------------------------------------------------------------------------------------------------------------*/