3 Replies Latest reply on Apr 19, 2012 1:23 AM by gayathri.vasudevan

    Last byte repeat, On NextData/ActivateData in the GPIF write Waveform Interval

    han.il

      Hello,everyone!

         

       

         

      I am using GPIF write waveform to send less than 512 bytes data block.

         

      I referenced Knowledge Base Article "NextData/ActivateData in the GPIF read Waveform Interval".

         

      In this paper,

         

      In order to write data from the FIFO to the external peripheral, you will do an activate data first in one interval. Doing this will result in driving the first byte in the FIFO on to the GPIF data bus and then you may do a Next FIFO Data on the subsequent interval. Doing an Activate Data and a Next FIFO Data on the same interval will result in incrementing the FIFO  pointer and driving the new data (pointed to by the incremented pointer) and should be done in subsequent intervals. Therefore a Next FIFO Data is required in case of GPIF Write

         

      I activated data first in one interval(Same Data),and Next FIFO Data on the subsequent interval.

         

      I writed 256 bytes “0x00, 0x01,…, 0xFF”,but read  data is 258 bytes “0x00, 0x01,…, 0xFF,0xFE, 0xFF”.

         

      So , last 2 byte in the FIFO,” 0xFE ,0xFF” repeated.

         

      What is the reason?

         

      The source code is as following.

         

       

         

      // we are just using the default values, yes this is not necessary...

         

      TD_INIT()

         

      {

         

                   EP2CFG = 0xA2;                               //           double buffer,bulk

         

                   SYNCDELAY;                   

         

         

      EP2FIFOCFG = 0x15;                                      //00010101 : AUTOOUT=1, ZEROLEN=1, WORDWIDE=1

         

                   EP2AUTOINLENH = 0x02;                    // When AUTOOUT=1, core commits IN data

         

                   SYNCDELAY;

         

                   EP2AUTOINLENL = 0x00;                     // ...when EPxAUTOINLEN value is met

         

                   SYNCDELAY;

         

                   EP2GPIFFLGSEL = 0x01;                    //           FiFo empty Flag

         

         

      }

         

       

         

      void TD_Poll(void)              // Called repeatedly while the device is idle

         

      {

         

                   if( GPIFTRIG & 0x80 )           // GPIF is Idle

         

                   {

         

                                 if(!(EP2468STAT & bmEP2EMPTY))

         

                                 {

         

                                              GPIFTRIG = GPIFTRIGWR | GPIF_EP2;

         

                                 }

         

         

      }

         

      }

         

       

         

      In Waveform, I repeated “Next FIFO Data on the subsequent interval” until EP2GPIFFLG empty.

        • 1. Re: Last byte repeat, On NextData/ActivateData in the GPIF write Waveform Interval
          gayathri.vasudevan

           Hi,

             

           

             

          Can you please share with us why you want read from the Slave device more data than is transferred from the host ? Since it is in the Auto mode, you are supposed to read only as many bytes as is transferred from host, as only so many bytes gets auto committed. If you want applications like adding a few more bytes onto the packet by the 8051, then you will have to choose the manual mode.

             

          In auto mode, please modify your GPIF waveform such that it will terminate the Write waveform when either Transaction count reaches zero / Empty flag gets asserted.

             

           

             

          Regards,

             

          Gayathri

          • 2. Re: Last byte repeat, On NextData/ActivateData in the GPIF write Waveform Interval
            han.il

            Thank you Gayathri for your answer.

               

            I am developing ITS(ITS(Intelligent Transportation System) device.

               

            The core of ITS deviceis Xilinx Spatarn 3A.

               

            PC sends necessary parameters to ITS via USB,and ITS sends recognized car information including car image to PC via EZ-USB.  Naturally received packet is longer than send packet.

               

            Send packet length is not const  and Receive packet length is Const.

               

            When ITS device is reset, PC first handshake necessary information with ITS device 5~8 times.

               

            Main key in handshaking with EZ-USB is to smothly changing From FIFO write waveform to   FIFO read waveform,and From FIFO read waveform to   FIFO write waveform.

               

            I solved this problem as following:

               

            void TD_Poll(void)     

               

            {

               

             if(!(EP2468STAT & bmEP2EMPTY))
                {
                       if(bGPIFRD==TRUE)
                        {
                                GPIFTRIG = GPIFTRIGWR | GPIF_EP2;    //    send GPIF data to endpoint2
                                bGPIFRD=FALSE;
                              
                        }
                else if(bGPIFRD==FALSE)
                {
                       GPIFTRIG = GPIFTRIGRD | GPIF_EP6;
                       bGPIFRD=TRUE;
                 }

               


            I want to use GPIFDONE flag,but it does't work properly.

               

            My question is as following:

               

            best way to use GPIFDONE flag.

            • 3. Re: Last byte repeat, On NextData/ActivateData in the GPIF write Waveform Interval
              gayathri.vasudevan

               HI,

                 
                 

               

                 
                 

              GPIFDONE flag is indication of whether the GPIF transaction has been completed or not, whether it be write/ read transaction. Before you are triggering GPIF transaction, you need to poll for GPIFDONE flag so as to know whether the previous transaction is complete or not. Please refer code snippets in page 7 and 8 in http://www.cypress.com/?docID=34260

                 
                 

               

                 
                 

              Regards,

                 
                 

              Gayathri