我想通过SlaveFIFO模式把主机数据通过EZ-USB传输给FPGA。外部MCU的数据通过SlaveFIFO模式已经用CYpress Console软件不断的读出来了!
可是我把端点2设为OUT端点用CYpress Console软件确发不出来,提示Bulk OUT failed。
这是我的TD_INIT()函数。
void TD_Init(void) // Called once at startup
{
// set the CPU clock to 48MHz
CPUCS = 0x12;
SYNCDELAY;
//ÒÔÉ϶¨ÒåMCUÉèÖÃ
PINFLAGSAB = 0xE8; //FLAGA - EP2EF, FLAGB - EP6FF
SYNCDELAY;
PINFLAGSCD = 0x00; //FLAGC INDEX, FLAGD INDEX
SYNCDELAY;
PORTACFG |= 0x40; //0x40; //SLCS, set all. func. of PA7pin
SYNCDELAY;
// set the slave FIFO interface to 48MHz
IFCONFIG = 0x43;
SYNCDELAY;
EP1OUTCFG = 0xA0;
EP1INCFG = 0xA0;
SYNCDELAY; // see TRM section 15.14
EP2CFG = 0xA2; //EP2 valid OUT ÅúÁ¿´«Êä, Ë«»º³å
SYNCDELAY;
EP4CFG = 0x02; //EP4 valid OUT ÅúÁ¿´«Ê䣬EP4ÎÞЧ
SYNCDELAY;
EP6CFG = 0xE2; //EP6 valid IN ÅúÁ¿´«Êä, Ë«»º³å
SYNCDELAY;
EP8CFG = 0x02; //EP8 valid IN ÅúÁ¿´«Ê䣬EP8ÎÞЧ
SYNCDELAY;
FIFORESET = 0x80; //active NAK-ALL to avoid race conditions
SYNCDELAY;
FIFORESET = 0x02; //reset,FIFO2
SYNCDELAY;
FIFORESET = 0x04; //reset,FIFO4
SYNCDELAY;
FIFORESET = 0x06; //reset,FIFO6
SYNCDELAY;
FIFORESET = 0x08; //reset,FIFO8
SYNCDELAY;
FIFORESET = 0x00; //de-active NAK-ALL
SYNCDELAY;
FIFOPINPOLAR = 0x00; //all signals active high.
SYNCDELAY;
REVCTL = 0x03;
SYNCDELAY;
EP2FIFOCFG = 0x01; //AUTOOUT = 0, WORLDWIDE = 1
SYNCDELAY;
// core needs to see AUTOOUT=0 to AUTOOUT=1 switch to arm endp's
EP2FIFOCFG = 0x11; //AUTOOUT = 1, WORLDWIDE = 1
SYNCDELAY;
EP6FIFOCFG = 0x0D; //AUTOIN = 1, ZEROLENGTH = 0, WORDWIDE = 1
SYNCDELAY;
EP6AUTOINLENH = 0x02;
SYNCDELAY;
EP6AUTOINLENL = 0x00;
SYNCDELAY;
EP2FIFOPFH = 0x88;
SYNCDELAY;
EP2FIFOPFL = 0x00;
SYNCDELAY;
INPKTEND = 0x84;
SYNCDELAY;
INPKTEND = 0x84;
SYNCDELAY;
OUTPKTEND = 0x80;
SYNCDELAY;
OUTPKTEND = 0x80;
SYNCDELAY;
//since the defaults are double buffered we must write dummy byte counts twice
EP2BCL = 0x80; // arm EP2OUT by writing byte count w/skip.
SYNCDELAY;
EP2BCL = 0x80;
SYNCDELAY;
WAKEUPCS |= 0x04; //enable then Dplus to wake up USB
//USBÓÐÈýÖÖ»½ÐÑģʽ£ºDPLUS»½ÐÑ£¬wakeup»½ÐÑ£¬WU2»½ÐÑ£¬Í¨¹ýÉèÖÃWakeupCS¼Ä´æÆ÷À´Ñ¡Ôñ¡£
// // enable dual autopointer feature
AUTOPTRSETUP |= 0x01;
}
请帮忙解决下,谢谢! |