What do you think the interrupt endpoint type in the USB spec is for? It's provided specifically so that you DON'T need to send poll packets, since the device gets a fixed slot in each frame where it notify the host controller that data is available.
Accepted - which was why I was trying to minimize the number of times I turned the bus around, since I was expecting that to be slow - what I wasn't expecting was even on a sequence of pure writes without any intervening reads that the throughput would degrade so badly with smaller write sizes.
I agree with you that it's not likely to give adequate performance - but I emphatically disagree with the idea that it's not important to understand why - the very first step to resolving a problem (or deciding that it can't be resolved) is to accurately identify what the source of it is. As it happens, I already knew enough about the USB protocol to know that the behavior I was seeing was not caused by protocol limitations - it had to be either the USB stack in Windows, the FTDI chip or both.
The actual answer is "both, but mostly Windows". The biggest limitation with the FTDI chips is that they do *everything* with bulk transfers - they don't support interrupt mode (which is strange, since USB<->Serial converters were one of the specific use cases that interrupt mode was designed for!) and they don't support isochronous mode (which is what you would normally use for bitbanging) and instead implement their own rather strange mode where they receive the data using bulk transfers and clock it out to the ports using one of the baud rate generators.
I also took that board into work and hooked it up to a USB protocol analyzer - and what was coming down the wire each frame was
<SOF><OUT Token><DATA><ACK Token> ... wait until end of frame ....
There were no NAKs (which might have caused the HCI stack to stall), and nothing else in the rest of the frame time. Interestingly, even if you used a very large block size part of the frame was still dead time, which suggests that the HCI stack in Windows is reserving time for interrupt and iso transfers even if nothing on that port is actually using them.
Interesting, but sort of irrelevant in this case - my testing was done with the chip acting as a bit bucket - as soon as the flag went high, the FPGA read the character and discarded it, so the only constraint was how fast the host could send data to it - and that appeared to be critically dependent on the block size in use.
I also repeated the experiment using one of the SiLabs USB chips, and got very much the same result - which tends to rule out both the D2XX drivers and the FTDI silicon and leave only the Windows USB stack as a common factor.
I didn't try it on Linux, but it works the way I would expect on FreeBSD and VxWorks - if you send multiple small packets with nothing between them they get merged, if you send alternating out and in packets then they are interleaved in the same frame.
Yeah, and it only seems to work on receive, too - so it would clearly have no effect at all on that output-only test.
In any event, getting decent performance on windows looks like it's going to require moving too much stuff into the converter - and a lot of it is the sort of thing that's going to be very painful to do in VHDL or verilog. So it looks like it's going to turn into an MCU based project.
I've also been giving some thought to making it as homebrew friendly as possible - the basic aim is that you can just solder unprogrammed devices to the board and then bring it up without using any device specific programming tools.
This is the current thought:
CPU - STM32F107VC
This device has USB and Ethernet on chip, but requires an external PHY for the Ethernet. It also has the ability to boot from USB using the internal ROM so all you need is the ST DFU software and you can load code into a blank chip just using a USB port.
Glue logic - XC9572XL
This is a small Xilinx CPLD holding the glue logic - the JTAG lines will be connected to GPIOs on the MCU so that people without a platform cable can download the CPLD config as a .xsvf file to the MCU and configure it that way without external hardware
Flash - AM29F020
Probably most easily programmed from the PSX side once the CPLD has been loaded, since it will just appear as a flash ROM at 0x1F000000
Again, all suggestions are welcome
