Re: [Fx2lib-devel] Sourcing slave FIFO packets
Status: Beta
Brought to you by:
mulicheng
From: Daniel O'C. <doc...@gs...> - 2011-02-28 02:53:28
|
On 28/02/2011, at 24:49, Chris McClelland wrote: > Daniel, thanks for your reply. I wasn't clear. It's not the PC that should > be getting this data, it is the FPGA attached to the EP6 slave FIFO. Since > it's just a FIFO it has no notion of NAK. For example, in the code below I > have set AUTOOUT=0. Now whenever an EP6 packet arrives from the host, > fifo_send() is invoked which rewrites the packet to a dummy set of bytes. I > tested this and it works. So far so good. But, crucially, if I invoke > fifo_send() on some_other_condition() e.g a button press, the FPGA sees > nothing on the FIFO. Is it just not possible to manually prod the slave > FIFOs like this? Or am I missing something? Ahh hmm.. I haven't used slave FIFO so I don't know :( I suspect you can't fake an out packet though so I think you may be out of luck.. ie it's OK when you send to EP6 from the PC because everything is set up and so when you allow the packet through it works. AFAIK you can only generate IN packets (and sink OUT packets) using firmware, you can't generate an OUT packet. If you use GPIF you can manually trigger read & write waveforms with data the micro chooses using XGPIFSGLDATL/XGPIFSGLDATH. > > // Called once at startup > // > void main_init(void) { > FIFOPINPOLAR = 0x03; > SYNCDELAY(); CPUCS = bmCLKSPD1; // 48MHz > SYNCDELAY(); IFCONFIG = (bmIFCLKSRC | bm3048MHZ | bmIFCLKOE | > bmSYNCFIFOS); > SYNCDELAY(); REVCTL = (bmDYN_OUT | bmENH_PKT); > SYNCDELAY(); EP6CFG = (bmVALID | bmBULK | bmDOUBLEBUFFERED); > SYNCDELAY(); FIFORESET = bmNAKALL; > SYNCDELAY(); FIFORESET = bmNAKALL | 6; // Reset EP6 > SYNCDELAY(); FIFORESET = 0x00; > SYNCDELAY(); EP6FIFOCFG = 0x00; > SYNCDELAY(); OUTPKTEND = bmSKIP | 6; > SYNCDELAY(); OUTPKTEND = bmSKIP | 6; > sendCount = 0; > } > > // Compose a packet to send on the EP6 FIFO, and commit it. > // > void fifo_send(void) { > EP6FIFOBUF[0] = 0x00; > EP6FIFOBUF[1] = 0x01; > EP6FIFOBUF[2] = 0x00; > EP6FIFOBUF[3] = 0x00; > EP6FIFOBUF[4] = 0x00; > EP6FIFOBUF[5] = sendCount++; > SYNCDELAY(); EP6BCH = 0; > SYNCDELAY(); EP6BCL = 6; > } > > // Called repeatedly while the device is idle > // > void main_loop(void) { > if ( !(EP2468STAT & bmEP6EMPTY) ) { > fifo_send(); > } > if ( some_other_condition() ) { > fifo_send(); > } > } > > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs and other IT data in > Real-Time with Splunk. Collect, index and harness all the fast moving IT data > generated by your applications, servers and devices whether physical, virtual > or in the cloud. Deliver compliance at lower cost and gain new business > insights. http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > Fx2lib-devel mailing list > Fx2...@li... > https://lists.sourceforge.net/lists/listinfo/fx2lib-devel > -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C |