我也遇到类似问题,请大家帮忙看看:
68013A端点EP8 IN的BULK读失败
68013A采用slavefifo方式进行bulk读写操作
我用EP2做OUT端点,512字节,2重缓冲
用EP8做IN端点,512字节,2重缓冲
现象是:EP2正常通讯,EP8 上位机收到2次成功后,就一直是失败。
我把初始化代码贴上来给大家看看,是否初始化有问题。
void TD_Init( void )
{
CPUCS = 0x12;
IFCONFIG = 0x43;
PORTACFG = 0x40;
SYNCDELAY;
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;
PINFLAGSAB = 0x00; // PINFLAGSAB = 0xE0; FLAGA - indexed, FLAGB - EP6 FF
SYNCDELAY;
PINFLAGSCD = 0x00; // PINFLAGSCD = 0x08; FLAGC - EP2 EF, FLAGD - indexed
SYNCDELAY; // config the endpoints direction
EP1OUTCFG = 0xA0; //enable and bulk type
EP1INCFG = 0xA0;
SYNCDELAY; // see TRM section 15.14
EP2CFG = 0xA0;
SYNCDELAY;
EP8CFG = 0xE0;
SYNCDELAY;
EP4CFG = 0x00;
SYNCDELAY;
EP6CFG = 0x00;
SYNCDELAY;
OUTPKTEND = 0X82; //arming endpoint 2, perform OUTPKTEND 4 times since EP2 is 4x buffered
SYNCDELAY;
OUTPKTEND = 0X82;
SYNCDELAY;
OUTPKTEND = 0X82;
SYNCDELAY;
OUTPKTEND = 0X82;
SYNCDELAY;
EP2FIFOCFG = 0x10; //EP IS AUTOOUT=1 AUTOIN =0 ZEROLEN=1 WORDIDE=0
SYNCDELAY;
EP8FIFOCFG = 0x08; //EP IS AUTOOUT=0 AUTOIN =1 ZEROLEN=1 WORDIDE=0
SYNCDELAY;
INPKTEND = 0x08;
SYNCDELAY;
INPKTEND = 0x08;
SYNCDELAY;
EP8AUTOINLENH = 0x02; //set the packet size 512
SYNCDELAY;
EP8AUTOINLENL = 0x00;
SYNCDELAY;
EP2BCL = 0x80; // arm EP2OUT by writing byte count w/skip.
SYNCDELAY;
EP2BCL = 0x80;
SYNCDELAY;
} |