Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > Questons in < ez_usb_fx2_gpif_primer___an1197_12.pdf>?

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Questons in < ez_usb_fx2_gpif_primer___an1197_12.pdf>?
Moderator:
RSKV

Post Reply
Follow this topic



Questons in < ez_usb_fx2_gpif_primer___an1197_12.pdf>?

yxm posted on 24 Apr 2010 4:56 AM PST
Member
3 Forum Posts

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??




Re: Questons in < ez_usb_fx2_gpif_primer___an1197_12.pdf>?

techwiz posted on 07 May 2010 11:32 PM PST
Member
2 Forum Posts

Hi! 

    A similar thread has been posted at http://www.keil.com/forum/docs/thread13370.asp.

I do face similar problem to trigger the GPIF write waveform. All instructions,but GPIFTRIG=GPIF_EP2, works

What is causing the GPIF write operation to hang?



Re: Questons in < ez_usb_fx2_gpif_primer___an1197_12.pdf>?

Jony posted on 16 Aug 2010 01:38 AM PST
Member
4 Forum Posts
I have the same problem, and I fix it as below: 1. My PC Host software (write self) send data length before GPIF transfer. 2. Firmware receive the length. So you can set your gpif TC as: GPIFTCB3 = DataLens[0]; SYNCDELAY; GPIFTCB2 = DataLens[1]; SYNCDELAY; GPIFTCB1 = DataLens[2]; SYNCDELAY; GPIFTCB0 = DataLens[3]; SYNCDELAY; NOTE: DataLens[4] stored data length. As the code before, I can finished my GPIF write successfully! But I found the transfer is not stable. Can anyone give some ideas?

Re: Questons in < ez_usb_fx2_gpif_primer___an1197_12.pdf>?

posted on 19 Aug 2010 11:52 PM PST
Member
4 Forum Posts

 

If you send only 10 bytes, since you have specified a txn count of 256, the gpif controller would keep waiting for the rest 246 bytes. In this interval, the vendor commands will not be served. You need to complete the full transfer before you can do that again.

 

 

 






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20