AUTOOUT=1下,PC发来数据到OUT端,为什么空标志还是0?
void TD_Init(void) // Called once at startup
{
// set the CPU clock to 48MHz
CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1); //48M
IFCONFIG |= 0x0B;//异步,从FIFO模式.
PORTACFG|=0X40;
FIFOPINPOLAR = 0x00; // set all slave FIFO interface pins as active low PKTEND OR SLOE SLWR LOW AVTIVE
SYNCDELAY;
REVCTL = 0x03; // enable the external master
SYNCDELAY;
//reset the fifos
FIFORESET = 0x80;
SYNCDELAY;
FIFORESET = 0x02;
SYNCDELAY;
FIFORESET = 0x04;
SYNCDELAY;
FIFORESET = 0x06;
SYNCDELAY;
FIFORESET = 0x08;
SYNCDELAY;
FIFORESET = 0x00;
SYNCDELAY;
//fix the slave fifo flags, only flagb and flagc
//PINFLAGSAB = 0x89; //F,FLAGB IS THE FIFO2 EMPTY FLAG,LAGA IS THE FIFO4 EMPTY FLAG
//SYNCDELAY;
PINFLAGSAB = 0xE8; //FLAGC IS THE FIFO6 FULL FLAG
SYNCDELAY;
// config the endpoints direction
EP1OUTCFG = 0xA0;//enable and bulk type
EP1INCFG = 0xA0;
SYNCDELAY; // see TRM section 15.14
EP8CFG = 0x60;
SYNCDELAY;
EP4CFG = 0x20;
SYNCDELAY;
EP6CFG = 0xe2;//enable IN bulk 512 DOUBLE buffer
SYNCDELAY;
EP2CFG = 0xA2;
SYNCDELAY;
//-------------------------
INPKTEND = 0x06;
SYNCDELAY;
INPKTEND = 0x06;
SYNCDELAY;
OUTPKTEND = 0x82;
SYNCDELAY;
OUTPKTEND = 0x82;
SYNCDELAY;
EP2BCL = 0x80; // arm EP2OUT by writing byte count w/skip.
SYNCDELAY;
EP2BCL = 0x80;
SYNCDELAY;
EP2FIFOCFG = 0x11;//EP2 IS AUTOOUT=1 AUTOIN =0 ZEROLEN=0 WORDIDE=1 配置EP6自动方式16位总
SYNCDELAY;
//config the endpoint6
EP6FIFOCFG = 0x0D;//EP6 IS AUTOOUT=0 AUTOIN =1 ZEROLEN=1 WORDIDE=1 配置EP6自动方式16位总
SYNCDELAY;
//----------------------------------------
EP6AUTOINLENH = 0x02; //set the packet size 512
SYNCDELAY;
EP6AUTOINLENL = 0x00;
SYNCDELAY;
// arm EP2OUT by writing byte count w/skip.
// SYNCDELAY;
// since the defaults are double buffered we must write dummy byte counts twice
//SYNCDELAY;
/*EP2BCL = 0x80; // arm EP8OUT by writing byte count w/skip.
SYNCDELAY;
EP2BCL = 0x80; */
SYNCDELAY;
Rwuen = TRUE; |