Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > Why when set EP2AUTOINLENH to 0x04 the slave fifo is not work?

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



Why when set EP2AUTOINLENH to 0x04 the slave fifo is not work?
Moderator:
RSKV

Post Reply
Follow this topic



Why when set EP2AUTOINLENH to 0x04 the slave fifo is not work?

zeen posted on 08 May 2012 11:34 PM PST
Member
8 Forum Posts

I used the slave fifo of fx2lp to send data by EP2,but the fifo is not work so well when set EP2AUTOINLENH to 0x04,but it worked well   when set EP2AUTOINLENH to 0x02!!! In other words, EP2AUTOINLENH can not be set to larger than 0x02.I guess there was someting wrong with the init code,may the init sequence is not right.

Here is the init code:

void TD_Init(void)             // Called once at startup
{

       // set the CPU clock to 48MHz

        CPUCS = 0x12; 
         SYNCDELAY;

        // set the slave FIFO interface to 48MHz

        IFCONFIG = 0x43;

        SYNCDELAY;

        // configure REVCTL

        REVCTL = 0x03;

        SYNCDELAY;

               // configure varies EndPoints        
        EP2CFG = 0xE8; // enabled, quad buffered, 1024B, IN, bulk fifo

        SYNCDELAY;                    // see TRM section 15.14

        EP4CFG = (EP4CFG & 0x7F); // disabled...

        SYNCDELAY;                    // see TRM section 15.14

        EP6CFG = (EP6CFG & 0x7F); // disabled, quad buffered, 512B(?), OUT, bulk fifo

        SYNCDELAY;                    // see TRM section 15.14

        EP8CFG = (EP8CFG & 0x7F); // disabled...

        SYNCDELAY;

        // configure the EPxFIFOCFG

        EP2FIFOCFG = 0x0C; // autoin, zero enable,8bit data bus

        SYNCDELAY;                    // see TRM section 15.14

        SYNCDELAY; 

        EP4FIFOCFG = 0x00;

        SYNCDELAY;          

        SYNCDELAY;         

        EP6FIFOCFG = 0x00; 

        SYNCDELAY;       

        SYNCDELAY;         

        EP8FIFOCFG = 0x00;

        SYNCDELAY;       

        SYNCDELAY;              

        FIFOPINPOLAR = 0x0; 

        SYNCDELAY; 

        EP2AUTOINLENH = 0x04; // 0x04 made the fifo unwork!But 0x02 is OK!

        SYNCDELAY;

        EP2AUTOINLENL = 0x00;

        SYNCDELAY;

        // enable dual autopointer(s)

        AUTOPTRSETUP |= 0x01; 

          // reset all fifos

        FIFORESET = 0x80; // reset all FIFOs

        SYNCDELAY;

        FIFORESET = 0x02;

        SYNCDELAY;

        FIFORESET = 0x04;

        SYNCDELAY;

        FIFORESET = 0x06;

        SYNCDELAY;

        FIFORESET = 0x08;

        SYNCDELAY;

        FIFORESET = 0x00;

        SYNCDELAY;

 }

Did anyone  know the reason?I must set EP2AUTOINLENH  to" 0x4" for special useage though "0x2"  can make the fifo work.




Re: Why when set EP2AUTOINLENH to 0x04 the slave fifo is not work?

zeen posted on 08 May 2012 12:16 AM PST
Member
8 Forum Posts

Only EP2 is in use.The descriptor in dscr.a51 is :

;; Endpoint Descriptor
      db   DSCR_ENDPNT_LEN      ;; Descriptor length
      db   DSCR_ENDPNT          ;; Descriptor type
      db   82H                  ;; Endpoint number, and direction
      db   ET_BULK               ;; Endpoint type ET_INT ET_BULK
      db   00H                  ;; Maximun packet size (LSB)
      db   02H                  ;; Max packect size (MSB)
      db   00H                  ;; Polling interval

 

The Max packect size of bulk in usb2.0 is 512 bytes,but someone told me change "db 02H" to "db 04H",I tried ,and found a strange problem,the host did not pendding any more,but noly returned 512 bytes from the ezusb driver every time even I request 1024*1024 bytes to read on my application.



Re: Why when set EP2AUTOINLENH to 0x04 the slave fifo is not work?

PRJI posted on 09 May 2012 10:36 PM PST
Cypress Employee
333 Forum Posts

 

In Auto-In mode, the auto-commit packet size may be set to any non-zero value (with the single restriction, of course, that the packet size must be less than or equal to the size of the endpoint buffer). In your case buffer size is 512 bytes and packet size is 1024.

Yes you are right, maximum packet size for a Bulk endpoint must be 512 bytes. Buffer size is  512 bytes in descriptor file but in init function  EP2CFG = 0xE8; // enabled, quad buffered, 1024B, IN, bulk fifo: it is 1024, please change it.

If you need packet size of 1024 you can use Isochronous or Interrupt endpoints.

 

 



Re: Why when set EP2AUTOINLENH to 0x04 the slave fifo is not work?

zeen posted on 09 May 2012 02:48 AM PST
Member
8 Forum Posts

Thanks ,I have another question.If I use BULK mode on EP2,config EP2 to 1024X4 buffered and EP2AUTOINLENH = 0x02,the high 512 bytes of the 1024 buffer is not used at all?In this case ,there is no difference between set EP2 to 512x4 or 1024x4 buffered?



Re: Why when set EP2AUTOINLENH to 0x04 the slave fifo is not work?

PRJI posted on 11 May 2012 05:32 AM PST
Cypress Employee
333 Forum Posts

 Hi,

 The endpoint configuration of 1024 bytes is not supported for bulk-endpoints. For Bulk endpoints maximum packet size must be 512 bytes .

Thanks

Prajith






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