最近做dsp的usb通信,当28335从usb芯片的FIFO 中获取数据时发现16位数据传输时,只能获取高8位数据,低8位数据丢失,比如,我往usb芯片out 端点发送4个16进制数12 34 56 78,dsp中定义unsigned int data[512]数组来获取数据,直接从FIFO地址读取data[i]=*USB_FIFO2;发现data[1]=0x3400,data[2]=0x7800,数据丢失了12和56.不知道原因所在啊。
外部接口时序配置如下
EALLOW; XintfRegs.XINTCNF2.bit.XTIMCLK = 1; // No write buffering
XintfRegs.XINTCNF2.bit.WRBUFF = 0; // XCLKOUT is enabled
XintfRegs.XINTCNF2.bit.CLKOFF = 1; // XCLKOUT = XTIMCLK/2
XintfRegs.XINTCNF2.bit.CLKMODE = 1; /* Zone 0 —————————————————————*/ // When using ready, ACTIVE must be 1 or greater // Lead must always be 1 or greater // Zone write timing
XintfRegs.XTIMING0.bit.XWRLEAD = 3;
XintfRegs.XTIMING0.bit.XWRACTIVE = 7;
XintfRegs.XTIMING0.bit.XWRTRAIL = 3; // Zone read timing
XintfRegs.XTIMING0.bit.XRDLEAD = 3;
XintfRegs.XTIMING0.bit.XRDACTIVE = 7;
XintfRegs.XTIMING0.bit.XRDTRAIL = 3;
// double all Zone read/write lead/active/trail timing
XintfRegs.XTIMING0.bit.X2TIMING = 1;
// Zone will NOT sample XREADY signal
XintfRegs.XTIMING0.bit.USEREADY = 0;
XintfRegs.XTIMING0.bit.READYMODE = 0; // sample asynchronous
XintfRegs.XTIMING0.bit.XSIZE = 3;
Victor Zheng:
你可以发个FFFF到USB芯片,然后用28335读,用示波器抓一下读取时低8位上的电平,以确认USB芯片已经把数据放到了总线上。