Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > FX2 EP manual mode problem

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



FX2 EP manual mode problem
Moderator:
RSKV

Post Reply
Follow this topic



FX2 EP manual mode problem

knk posted on 05 Jun 2012 11:15 AM PST
Member
3 Forum Posts

Hello

I trying to make transfer to external master from EP4, but empty flag (Flag A in my configuration) is always active. If I don't arm EP4 buffers I see single transfer with right data, but then it stuck again.  My code

 void TD_Init(void)             // Called once at startup

{

    // set the CPU clock to 48MHz

    CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1) ;

    IFCONFIG = 0xE3; SYNCDELAY;  // Enable slave FIFO Interface @48MHz// KNK

    REVCTL = 0x03; SYNCDELAY;

    // Endpoints configuration

  EP1OUTCFG = 0xA0; SYNCDELAY;   // Configure EP1OUT as BULK EP

    EP1INCFG = 0xB0; SYNCDELAY;    // Configure EP1IN as BULK IN EP

    

  EP4CFG = 0xA0; SYNCDELAY;      // Configure EP4 as BULK OUT EP 

  EP8CFG = 0xE0; SYNCDELAY;      // Configure EP8 as BULK IN EP 

// FIFO Reset

    FIFORESET = 0x80;  SYNCDELAY;  // NAK all requests from host.

    FIFORESET = 0x82;  SYNCDELAY;  // Reset individual EP (2,4,6,8)

    FIFORESET = 0x84;  SYNCDELAY;

    FIFORESET = 0x86;  SYNCDELAY;

    FIFORESET = 0x88;  SYNCDELAY;

    FIFORESET = 0x00;  SYNCDELAY;  // Resume normal operation.

    // Arm buffers

    //OUTPKTEND = 0x84; SYNCDELAY;

    //OUTPKTEND = 0x84; SYNCDELAY;

    // Configure flags

    PINFLAGSAB = 0xF9; SYNCDELAY; //FlagA = EP4EF, FlagB = EP8FF

    //PINFLAGSCD = 0x08; SYNCDELAY; //FlagC = EP2EF,    FlagD = not used

    // Fifo Config

    EP2FIFOCFG = 0x00; SYNCDELAY;  // Disable Wordwide

    EP4FIFOCFG = 0x00; SYNCDELAY;  // Configure EP4 FIFO in 8-bit Manual mode

    EP6FIFOCFG = 0x00; SYNCDELAY;  // Disable Wordwide

    EP8FIFOCFG = 0x0C; SYNCDELAY;  // Configure EP8 FIFO in 8-bit AutoIn mode

 

    PORTACFG = 0x00; SYNCDELAY; // used PA7/FLAGD as a port pin, not as a FIFO flag

    FIFOPINPOLAR = 0x00; SYNCDELAY; // set all slave FIFO interface pins as active low

    EP8AUTOINLENH = 0x02; SYNCDELAY; // EZ-USB automatically commits data in 512-byte chunks

    EP8AUTOINLENL = 0x00; SYNCDELAY;

    OEA=0x80;

}

 

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

{

...

    EP4FIFOBUF[0] = 0x57;

    EP4FIFOBUF[1] = 0x57;

    EP4FIFOBUF[2] = 0x57;

    EP4FIFOBUF[3] = 0x57;

    EP4BCH = 0; SYNCDELAY;

    EP4BCL = 4; SYNCDELAY;

...

}

What I did wrong ? I already tryed to reset EP4 FIFO or do OUTPKTEND = 0x04 in TD_Poll but nothing helps.
 
 
Alex



Re: FX2 EP manual mode problem

Gayathri posted on 06 Jun 2012 10:43 PM PST
Cypress Employee
428 Forum Posts

 Hi Alex,

 

I find from the piece of code that the endpoint configuration that you have used (EP4 & EP8 double buffered) is invalid. Please take a look at section 1.17 EZ-USB Endpoint Buffers from EZ-USB TRM (http://www.cypress.com/?rID=38232). Use one among the 12 valid EP configurations shown in the section, and see if this fixes the issue.

 

Regards,

Gayathri



Re: FX2 EP manual mode problem

knk posted on 06 Jun 2012 11:21 PM PST
Member
3 Forum Posts

 Hi Gayathri

I already try different combinations for EP4 and EP2 - nothing helps. Looks like problem that I trying to generate packet by CPU for OUT EP having empty FIFO. It's works for IN EP, but looks like not working for OUT. 

So the question is, how to source packet for OUT EP having empty FIFO. When I just write to buffer and commit by writing to EP4BCL or EP2BCL - empty flag not changed. How to control FIFO flags ?

    // Config #1 - not working

EP2CFG = 0xA2; SYNCDELAY;      // EP2 is DIR=OUT, TYPE=BULK, SIZE=512x2

  EP4CFG = 0xA0; SYNCDELAY;      // Configure EP4 as BULK OUT EP

  EP6CFG = 0xE2; SYNCDELAY;      // Unused EP4 is IDIR=IN, TYPE=BULK, SIZE=512, BUF=2x

  EP8CFG = 0xE0; SYNCDELAY;      // Configure EP8 as BULK IN EP 

 

    // Config #4 - not working

EP2CFG = 0xA0; SYNCDELAY;      // Unused EP2 is DIR=OUT, TYPE=BULK, SIZE=512, BUF=4x

  EP4CFG = 0x20; SYNCDELAY;      // Disabled

  EP6CFG = 0xA2; SYNCDELAY;      // Unused EP4 is IDIR=OUT, TYPE=BULK, SIZE=512, BUF=2x

  EP8CFG = 0xE0; SYNCDELAY;      // Configure EP8 as BULK IN EP 

 

    // Config #7 - not working

EP2CFG = 0xAA; SYNCDELAY;      // Unused EP2 is DIR=OUT, TYPE=BULK, 1024x2

  EP4CFG = 0x20; SYNCDELAY;      // Disabled

  EP6CFG = 0xA2; SYNCDELAY;      // Unused EP4 is IDIR=OUT, TYPE=BULK, SIZE=512, BUF=2x

  EP8CFG = 0xE0; SYNCDELAY;      // Configure EP8 as BULK IN EP 

 

    // Config #11 - not working

EP2CFG = 0xAB; SYNCDELAY;      // Unused EP2 is DIR=OUT, TYPE=BULK, 1024x2

  EP4CFG = 0x20; SYNCDELAY;      // Disabled

  EP6CFG = 0x20; SYNCDELAY;      // Unused EP4 is IDIR=OUT, TYPE=BULK, SIZE=512, BUF=2x

  EP8CFG = 0xE0; SYNCDELAY;      // Configure EP8 as BULK IN EP 

 



Re: FX2 EP manual mode problem

knk posted on 06 Jun 2012 09:37 AM PST
Member
3 Forum Posts

 Thanks All

I found problem and solve it. Before write to OUT EP buffer it should be dis-armed first!

 

Regards

Alex






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: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20