2 Replies Latest reply on Apr 1, 2019 10:27 PM by dach_3214351

    Fx2lp in gpif master mode

    dach_3214351

      Hi All,

       

      I desing GPIF master in transfer in Fx2lp.

      Set endpoint 6  to EP6CFG = 0xE0;     // EP6IN, bulk, size 512, 4x buffered

      and EP6FIFOCFG = 0x08; // EP6 is AUTOOUT=0, AUTOIN=1, ZEROLEN=0, WORDWIDE=0

       

      if ( GPIFTRIG & 0x80 )      // if GPIF interface IDLE
         {
         
         
          if ( !( EP68FIFOFLGS & EP6FULL ) )  // if EP6 FIFO is not full
          {  
          
           SYNCDELAY;
           GPIFTCB1 =0x10;      // setup transaction count
           SYNCDELAY;
           GPIFTCB0 = 0x50;
           SYNCDELAY;

           GPIFTRIG = GPIFTRIGRD | GPIF_EP6; // launch GPIF FIFO READ Transaction to EP6 FIFO
           SYNCDELAY;
           while( !( GPIFTRIG & 0x80 ) )   // poll GPIFTRIG.7 GPIF Done bit
           {
            ;
           }
           SYNCDELAY;
          
          }
         }

      I want to transfer  4176 bytes to PC but PC cannot get data.

      if I modify to transfer  4608 bytes then PC can get data.

      SYNCDELAY;

           GPIFTCB1 =0x12;      // setup transaction count

           SYNCDELAY;

           GPIFTCB0 = 0x00;

           SYNCDELAY;

       

      In PC, I set cyapi app as below:

      epBulkIn->BeginDataXfer((PUCHAR)pData,(LONG) Length, &inOvLap);

       

      length is 4176, cannot get data.

      length is 4608, can get data.

       

       

      The EP6 IN endpoints of both FX2LPs are in auto mode, and the AUTO IN packet length is set to 512. Therefore, if the

      data transferred is an integral multiple of 512 (bytes), it is auto-committed from the peripheral to the host side and is

      available on the host. This firmware can transfer data only when it is in integral multiples of 512 (bytes).

       

      if I want to transfer data when it is in not multiples of 512 (bytes),  how can I modify it.

       

      Thanks,

       

      Darren

        • 1. Re: Fx2lp in gpif master mode
          SananyaM_56

          Hello Darren,

           

          You can use the GPIF done interrupt by enabling it in the GPIFIRQ register and set the endpoint in manual mode in the ISR. You can then commit the last packet with bytes lesser than 512 using INPKTEND register (additionally adding a check for the FIFO full flag). This will cause the BeginDataXfer() API to treat the last packet as a short packet and display the same number of bytes which you will mention in the length parameter. Please refer to section 10.4.6 in the Technical Reference Manual for example code in Manual mode.

           

          Best Regards,

          Sananya

          • 2. Re: Fx2lp in gpif master mode
            dach_3214351

            Hi Sananya,

             

            I refer to your suggestion, I set the auto mode before GPIF reading, when GPIF reading is completed then set the manual mode and set INPKTEND registe.

            the pc can get 4176 bytes.

            Thanks for your help.

             

            BR,

             

            Darren