2 Replies Latest reply on Aug 19, 2010 1:52 AM by content.librarian

    Questons in < ez_usb_fx2_gpif_primer___an1197_12.pdf>?

    y.xm

      I do not understand a problem in < ez_usb_fx2_gpif_primer___an1197_12.pdf>.

         

      At page 32,

         

      TD_Poll()
      Code that handles USB OUT Transfers
      if( GPIFTRIG & 0x80 ) // if GPIF interface IDLE
      {  
        if ( ! ( EP24FIFOFLGS & 0x02 ) ) // if there's a packet in the peripheral domain for EP2
        {
          if ( EXTFIFONOTFULL ) // if the external FIFO is not full
          { 
            if(enum_high_speed)
            {
              SYNCDELAY;   
              GPIFTCB1 = 0x01; // setup transaction count (512 bytes/2 for word wide -> 0x0100)
              SYNCDELAY;
              GPIFTCB0 = 0x00;
              SYNCDELAY;
            }
            else
            {
              SYNCDELAY;
              GPIFTCB1 = 0x00; // setup transaction count (64 bytes/2 for word wide -> 0x20)
              SYNCDELAY;
              GPIFTCB0 = 0x20;
              SYNCDELAY;
            }
            Setup_FLOWSTATE_Write(); // setup FLOWSTATE registers for FIFO Write operation
            SYNCDELAY;
            GPIFTRIG = GPIF_EP2;     // launch GPIF FIFO WRITE Transaction from EP2 FIFO
            SYNCDELAY;
        
            while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 GPIF Done bit
            {
              ;
            }
            SYNCDELAY;
          }
        }
      }

         

      The first thing the OUT handling code does is it checks to see if the GPIF is IDLE. If so, it checks to see if there is at least one packet in the peripheral domain for EP2. Since EP2 is placed into auto mode, the firmware does not need to check if the host sent a USB packet. The USB packets are automatically committed to be used by the GPIF engine. Therefore, the firmware’s job is to check if at least one packet has been committed to the peripheral domain.
      Then, if the external FIFO is not full, the TC value is set up for word-wide operation. The TC value is a 32-bit register field, but for this application only the lower 16-bit fields are necessary. Since each GPIF FIFO Write transaction sends 512 bytes to the external FIFO over a 16-bit interface, the number of transactions is always half the number of bytes actually contained within the endpoint buffer. The appropriate TC value is set up for either high-speed (256) or full-speed (32) operation.
      The appropriate flow state registers are then set up for the FIFO Write transaction, and a write to the GPIFTRIG register with the appropriate bits triggers the transaction from EP2OUT. The code then waits for the transaction to complete before exiting out of the “if” nest.
       

         

      I don't  understand these sentens:"The USB packets are automatically committed to be used by the GPIF engine. Therefore, the firmware’s job is to check if at least one packet has been committed to the peripheral domain."
       

         

      What will happen if I send 10 words(not equal to 512 Bytes) to the EP2.

         

      I found if I send 10 words to EP2,I cannot send my vendor requet to ez-usb,why??