cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

Anonymous
Not applicable

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.

4 Replies
Anonymous
Not applicable

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.

0 Likes
Anonymous
Not applicable

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.

0 Likes
Anonymous
Not applicable

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?

0 Likes
Anonymous
Not applicable

 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

0 Likes