external fifo | Cypress Semiconductor
I am totally confused about REVCTL and AUTOOUT. I have an FX2LP with a CPLD connected to the external fifo pins. The CPLD does nothing right now, but will soon read from EP2 and write to EP6. In the mean time, I'm trying to figure out the FX2LP side's configuration. I have it set for the following: EP2 = valid, bulk, out, 512 x2. EP4 = valid, bulk, out, 512 x2. EP6 = valid, bulk, IN, 512 x2. EP8 valid, bulk, IN, 512 x2.
My host is doing the following sequence:
1) usb_control_msg a vendorcmd (see case 0xBF in vendorcmd handler in attached bwtkusb.c) that reads 10 bytes. These 10 bytes are EP2FIFOFLGS, EP6FIFOFLGS, EP2FIFOBCH, EP2FIFOBCL, EP2468STAT, EP2CS, EP2FIFOBUF, EP2FIFOBUF, EP2FIFOBUF and EP2FIFOBUF
2) usb_bulk_write of 4 bytes to EP2
3) repeat step one, to compare all the flags and data.
I started by using the bulkloop firmware as an example. Now, after reading through the EZ-USB TRM thoroughly I have modified the firmware to set it up for external fifo. The problem is that as soon as I try to follow the recommendation in the TRM to set REVCTL[1:0] to 11b, and set EP2's AUTOOUT=1, then trying to write to that endpoint from the host results in a timeout. I tried setting OUTPKTEND=0x82 also, but does not affect anything. I also tried doing a FIFORESET=0x80; FIFORESET=2; FIFORESET=0; prior to the OUTPKTEND=1 line, but that doesn't help either.
The ONLY configuration I can use that allows me to send data to the endpoint is 1) REVCTL[1:0] = 00b, EP2FIFOCFG.AUTOOUT=0 or 2) REVCTL[1:0]=01b, EP2FIFOCFG.AUTOOUT=0. In either case, I can SEE the data I sent in EP2FIFOBUF...EP2FIFOBUF.. and EP2's Empty flag is no longer set. However, EP2FIFOFLGS are report that the fifo is empty.
Unless I've misunderstood the TRM, then I believe what I want is to have REVCTL=3, EP2FIFOCFG.AUTOOUT=1, and that this means I may have to "prime the pump" (as stated in TRM) by "initially arming the endpoints (OUTPKTEND w/SKIP=1 to pass packets to host)." Which is baffling in and of itself.. OUTPKTEND is for "OUT".. what does that have to do with "passing packets TO HOST"???????
While its true that nothing is sucking data out of the fifo yet, after i send 4 bytes from the host (which i can't even do) to EP2, I should see EP2FIFOBCL=4, EP2FIFOFLGS=NOTEMPTY,... but instead i see EP2FIFOBCL=0, EP2FIFOFLGS=EMPTY, EP2CS.EMPTY=0, EP2BCL=2. I want to simply send 4 bytes from the host and have it IMMEDIATELY available on the fifo pins with no interaction from the 8051. This shouldn't be that difficult to accomplish, but I'm getting meeting nothing but frustration. Anyone know what is going on here?
The only change I made to fw.c was in main(), just before the call to TD_Init(). I put this: REVCTL=0x03;
thank you for any help!