阅读:2474回复:9
求助CY7C68013的Slave FIFO模式
我用的是Cypress的CY7C68013开发板,Slave FIFO模式,端点EP6 BULK IN方式连续读取8位数据总线PB7~PB0,内部48M同步IFCLK,512×2,AUTOIN=1,ZEROLENIN=1,WORDWIDE=0 。但用ControlPanel(Interface=0 Alt Setting=1),始终无法正确接收EP6IN的数据,
困扰多日请高手指点。十分感谢! 由于EP6只是读总线,故我的外围电路连接如下: OE#=1 ,RD#=1 ,WR#=0 ,CS#=0 ,PA4(FIFOADR0)=0 ,PA5(FIFOADR1)=1 ,PA6(PKTEND)=1 我的固件关键代码如下: void TD_Init( void ) { CPUCS = 0x10; // CLKSPD[1:0]=10, for 48MHz operation SYNCDELAY; REVCTL=0x03; SYNCDELAY; SYNCDELAY; IFCONFIG = 0xC3; // IFCLKSRC=1 , FIFOs executes on internal clk source // xMHz=1 , 48MHz internal clk rate // IFCLKOE=0 , Don\'t drive IFCLK pin signal at 48MHz // IFCLKPOL=0 , Don\'t invert IFCLK pin signal from internal clk // ASYNC=0 , master samples synchronous // GSTATE=0 , Don\'t drive GPIF states out on PORTE[2:0], debug WF // IFCFG[1:0]=11, FX2 in slave FIFO mode EP6CFG = 0xE2; // DIR=IN ,BULK , 512*2 SYNCDELAY; FIFORESET = 0x80; SYNCDELAY; FIFORESET = 0x06; // reset, FIFO 6 SYNCDELAY; FIFORESET = 0x00; SYNCDELAY; EP6FIFOCFG = 0x0C; // AUTOIN=1, ZEROLENIN=1, WORDWIDE=0 SYNCDELAY; EP6AUTOINLENH=0x02; SYNCDELAY; EP6AUTOINLENL=0x00; SYNCDELAY; } void TD_Poll( void ) { // if EP6 IN is available, re-arm it if(EP8CS&&0x04) { SYNCDELAY; // EP6BCH = 0x02; SYNCDELAY; // EP6BCL = 0x00; } } |
|
沙发#
发布于:2005-02-28 07:51
你用同步传输,时序要求比较严格,会不会是你外部CPLD或DSP向68013发送的写时序有问题。你可以先试一下异步传输。看可不可以。
|
|
板凳#
发布于:2005-03-02 13:25
由于USB只是读取外部数据,故我将USB slave FIFO的写信号WR#直接拉低,读信号RD#拉高。
我觉得这样的写时序符合同步传输的要求啊,即在内部48M IFCLK的上升沿驱动下,写信号一直有效,PB7~PB0的数据就能连续地写入EP6FIFOBUF中去的。 但点击ControlPanel的BULK EP6point IN 指令就是没反应,改成异步传输也不见效果。 |
|
地板#
发布于:2005-03-02 14:29
你同步传输时序不符合Cypress给的同步传输时序图,在Cypress的时序图中WR是变化的。异步传输你是按时序图中的时序发的信号么?
|
|
地下室#
发布于:2005-03-02 15:48
我按照Cypress发布的68013技术文档(英文)Page 9-3页的时序图,配的同步写时序,EP6IN没反应。而且我这个数据采集系统的数据源是一个摄像头,它不提供WR信号给USB啊?只有同步PCLK、水平同步Hsync和垂直同步Vsync与USB发生关系啊?
给点案例或是发个详细点的Cypress同步传输读写时序图和异步传输读写时序图给我吧,感觉那个68013文档没说清楚,尤其是异步时序的。 感谢+感谢! EMAIL:mao.jf@ntu.edu.cn |
|
5楼#
发布于:2005-03-03 08:47
在这个文档中9.2.7-9.2.10有详细的时序图,我的从FIFO时序按Page 9-16页的时序图写的
你的设备要是不能提供写信号,能不能用68013的GPIF方式去读摄像头的数据。 我的从FIFO代码是这样写的,我觉得和你的差别不大,EP8不用,EP6用4×512。 void TD_Init(void) // Called once at startup { // set the CPU clock to 48MHz CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1); SYNCDELAY; REVCTL = 0x03; //Must set REVCTL.0 and REVCTL.1 to 1; SYNCDELAY; FIFORESET = 0x80; // RESET all FIFOS SYNCDELAY; FIFORESET = 0x02; // reset EP2 FIFO SYNCDELAY; FIFORESET = 0x04; // reset EP4 FIFO SYNCDELAY; FIFORESET = 0x06; // reset EP6 FIFO SYNCDELAY; FIFORESET = 0x08; // reset EP8 FIFO SYNCDELAY; FIFORESET = 0x00; // clear NAKALL bit to resume normal operation SYNCDELAY; IFCONFIG = 0xCB; //this defines the external interface as follows: // use internal IFCLK (48MHz) // use slave FIFO interface pins asynchronously to external master PINFLAGSAB = 0x00; // defines FLAGA as prog-level flag, pointed to by FIFOADR[1:0] SYNCDELAY; // FLAGB as full flag, as pointed to by FIFOADR[1:0] PINFLAGSCD = 0x00; // FLAGC as empty flag, as pointed to by FIFOADR[1:0] // won\'t generally need FLAGD PORTACFG =0x00; // used PA7/FLAGD as a port pin, not as a FIFO flag, // SLCS# can no use FIFOPINPOLAR = 0x00; // set all slave FIFO interface pins as active low SYNCDELAY; /////////////////////////////////////////////////////////////////////////////////// EP8FIFOCFG = 0x0C; // this lets the FX2 auto commit IN packets, gives the // ability to send zero length packets, // and sets the slave FIFO data interface to 8-bits EP8CFG = 0x60;//0xE0; // sets EP8 invalid for IN\'s // and defines the endpoint for 512 byte packets, 2x buffered SYNCDELAY; EP8AUTOINLENH = 0x02; // you can define these as you wish, SYNCDELAY; // to have the FX2 automatically limit IN\'s EP8AUTOINLENL = 0x00; SYNCDELAY; EP8FIFOPFH = 0x80; // you can define the programmable flag (FLAGA) SYNCDELAY; // to be active at the level you wish EP8FIFOPFL = 0x00; ////////////////////////////////////////////////////////////////////////////////// EP6FIFOCFG = 0x0C; // this lets the FX2 auto commit IN packets, gives the // ability to send zero length packets, // and sets the slave FIFO data interface to 8-bits EP6CFG = 0xE0; // sets EP6 valid for IN\'s // and defines the endpoint for 512 byte packets, 4x buffered SYNCDELAY; EP6AUTOINLENH = 0x02; // you can define these as you wish, SYNCDELAY; // to have the FX2 automatically limit IN\'s EP6AUTOINLENL = 0x00; SYNCDELAY; EP6FIFOPFH = 0x80; // you can define the programmable flag (FLAGA) SYNCDELAY; // to be active at the level you wish EP6FIFOPFL = 0x00; ////////////////////////////////////////////////////////////////////////////////// SYNCDELAY; EP2BCL = 0x80; SYNCDELAY; EP2BCL = 0x80; SYNCDELAY; EP4BCL = 0x80; SYNCDELAY; EP4BCL = 0x80; SYNCDELAY; } void TD_Poll(void) { } [编辑 - 3/3/05 by bjdxwz] |
|
6楼#
发布于:2005-03-03 16:25
非常感谢!
我按照你的代码,按下面的接法试了一下: 1、配置IFCLK=0,PKTEND=1,WR#接8M时钟,FD[7:0]=55H,点击ControlPanel的BULK EP6point IN 指令没反应; 2、配置IFCLK=0,PKTEND=0,WR#接8M时钟,FD[7:0]=55H,点击ControlPanel的BULK EP6point IN 指令,显示 Read IOCTL passed,但不见数据上来。 这是为什么? :( |
|
7楼#
发布于:2005-03-09 10:35
:(
|
|
8楼#
发布于:2005-03-09 22:11
这里有个论坛专门讨论68013芯片的开发,不错哦!
http://www.smset.com/zsbbs/main.htm |
|
|
9楼#
发布于:2005-03-10 13:06
自己顶一下
|
|