4 Replies Latest reply on Jul 23, 2013 8:16 AM by raghavan.n.s

    GPIF state machine bus config

    raghavan.n.s
              Is it possible to change the bus width of the state machine between 16bit and 8bit dynamically !! Currenltly i am disabling the state machine, changing the register values of CyFxGpifRegValue to get 16 or 8 bit data bus, then i reload the state machine , but this is not working for me , is it the correct method or is there any other method ??   
        • 1. Re: GPIF state machine bus config
          shashank.rebbapragada

           Hi,

             

           

             

          At what point in your code are you making these changes?

             

          I just tried this using a vendor command and handled the vendor command this way:

             

               CyU3PUsbAckSetup();

             

              CyU3PGpifDisable(1);

             

              CyFxGpifRegValue[1] = 0x00000003;

             

              retstatus = CyU3PGpifLoad(&CyFxGpifConfig);

             

              if(retstatus != CY_U3P_SUCCESS)

             

              CyU3PDebugPrint(1,"\r\n gpifload failed error %x \r\n",retstatus);

             

              retstatus = CyU3PGpifSMStart(0,0);

             

              if(retstatus != 0)

             

              CyU3PDebugPrint(1,"\r\n gpifsmstart failed error %x \r\n",retstatus);

             

              isHandled = 1;

             

           

             

          It works fine. The data width changed from 16 to 8 bits and the in data transfers work as expected.

             

           

             

          Regards

             

          Shashank

          • 2. Re: GPIF state machine bus config
            raghavan.n.s

            Yes i too do it in the same way.

               

            In one case i switch from 16 bit to 8 bit , so i change the registers 

               

            CyFxGpifRegValue[1]=0x00000067;  to -> CyFxGpifRegValue[1]=0x00000003;    /*  CY_U3P_PIB_GPIF_BUS_CONFIG */

               

            CyFxGpifRegValue[39] to half of the dma channel size for 8 bit     /*  CY_U3P_PIB_GPIF_DATA_COUNT_LIMIT */

               

            Is this recommended ??

               

            And after i load the state machine again , for one dma buffer size , the data is coming according to the 16bit configuration , only after that the data is coming according to the 8bit state machine..

               

            Does this mean the state machine takes some time to come to the 8 bit configuration ??

               

            If so why for one dma buffer size this issue is present ??

               

            Is there any other way to do this operation ??

               

            Thanks

               

            Rags

            • 3. Re: GPIF state machine bus config
              shashank.rebbapragada

               Hi,

                 

               

                 

              Not sure why exactly the first buffer after config change is still retaining the previous config.

                 

              However, try including the CyU3PDmaChannelReset() and CyU3PDmaChannelSetXfer() calls before the CyU3PGpifLoad() call in the vendor request. This should work.

                 

               

                 

              Regards

                 

              Shashank

              • 4. Re: GPIF state machine bus config
                raghavan.n.s

                 Thanks PRAG,

                   

                I tried as you said and its working with the CyU3PDmaChannelReset() and CyU3PDmaChannelSetXfer() calls , but i still dont understand why this was essential ?

                   

                Rags