Slave FIFO ISOC传输,AUTO IN 方式,上位机用的是从CYPRESS网站上down下来的cystream工具。按照cystream的使用方法,我设置为一次(暂且用一次吧,用词不太准确)传0x200*64=32KB的数据。
1,、如果是连续的数据,发现每次采到最开始的数据被一片 “00”(空,通过bushond看到的)覆盖,而且“00”的数量是随机的。
2.、如果是FPGA间隔一段时间发送数据,就会发现每次发送的数据都不是32KB(大部分为25600B),而且收到的数据很乱。
哪位大侠可以指导一下?
附固件代码:
设备初始化:
void TD_Init(void) // Called once at startup
{
/********************************************/
// int i,j;
CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1) ;
// set the slave FIFO interface to 48MHz
OEC |= 0x03; //端口C0、1 输出使能
IOC &= 0xfe; //端口C0=0
IFCONFIG = 0x43;
SYNCDELAY;
REVCTL = 0x03; // enable the external master
SYNCDELAY;
EP1OUTCFG = (EP1OUTCFG & 0x7F);
SYNCDELAY;
EP1INCFG = (EP1INCFG & 0x7F);
SYNCDELAY;
EP2CFG = (EP2CFG & 0x7F);
SYNCDELAY;
EP4CFG = (EP4CFG & 0x7F);
SYNCDELAY;
EP8CFG = (EP8CFG & 0x7F);
SYNCDELAY;
EP6CFG = 0xd0; // EP6 is DIR=IN, TYPE=ISOC, SIZE=512, BUF=4x
SYNCDELAY;
// Clear out any committed packets
FIFORESET = 0x80; //不应答所有传输
SYNCDELAY;
FIFORESET = 0x06; //复位端点6
SYNCDELAY;
FIFORESET = 0x00; //恢复
SYNCDELAY;
//config the endpoint6配置端点6向SIE自动提交、使能零长度包、选择8位总
EP6FIFOCFG = 0x0C;
SYNCDELAY;
PINFLAGSCD = 0x0E; //FLAGC IS THE FIFO6 FULL FLAG
SYNCDELAY;
EP6AUTOINLENH = 0x02; //set the packet size 512
SYNCDELAY;
EP6AUTOINLENL = 0x00;
SYNCDELAY;
PORTACFG = 0x00;
SYNCDELAY;
EP6ISOINPKTS = 0x01; //每个微帧的包的数量:1
SYNCDELAY;
FIFOPINPOLAR = 0x01; // set all slave FIFO interface pins as active low PKTEND OR SLOE SLWR LOW AVTIVE Slave FIFO 接口引脚极性 0 :低电平 1:高电平
SYNCDELAY;
// This register sets the number of Isoc packets to send per
// uFrame. This register is only valid in high speed.
mycount=0;
Rwuen = TRUE;
USBIE |= bmSOF; //清除起始帧中断请求
// Prepare data
}
接口和端点描述符
;; Interface Descriptor
db DSCR_INTRFC_LEN ;; Descriptor length
db DSCR_INTRFC ;; Descriptor type
db 0 ;; Zero-based index of this interface
db 0 ;; Alternate setting
db 1 ;; Number of end points
db 0ffH//0ffH ;; Interface class
db 00H ;; Interface sub class
db 00H ;; Interface sub sub class
db 0 ;; Interface descriptor string index
;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 86H ;; Endpoint number, and direction
db ET_ISO ;; Endpoint type
db 00H ;; Maximun packet size (LSB)
db 02H//14H ;; Max packect size (MSB)
db 01H ;; Polling interval
|