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

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
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