OpenOCD and Altera USB blaster.

I cannot claim to be an expert in this, but I’ll try to explain how I understand the baster operates.

The FT245 is just in stock parallel mode, with FIFO buffers for in and out transfers, not serial. This is not ‘bit bang mode’ as per the FT245 datasheet. In order to get a byte out of the 245 after the host has sent a packet, one must trigger the RD line. Writing is the same deal just different direction, in the ‘bit bang mode’ you are refering to, bytes are spat out of the FT245, in paralllel, at a rate determined by the ‘set baud rate’ - automatically, with no intervention from an external trigger. (I have read that FTDI added this mode purely for the purpose of USB pogramming adapters!)

The CPLD inside the blaster, although basic, is rather clever, as it monitors what these bytes are. It is a state machine which, gets a byte from the FT245 buffer (using the RD line) does what it wants with it, then reads another. Without the CPLD’s intervention, no bytes can come out of the FT245.

I ‘think’ the MSB of a byte determines what the CPLD does with it. Either, it simply copies the 6 LSB’s to its output port (changing the IO lines manually, for TCK, TMS etc…bit bang mode) or, if the MSB is set, it interprets this as an instruction with the 6/7 LSB’s representing the number of ‘data’ bytes that will follow. This way, the next X number of bytes, are loaded in, in parallel, and shot out the CPLD serially at full speed (byte shift mode). This means one byte into the CPLD = 8 bits out, with a clock. - Meant for long strings of data with no change on the TMS line. For any changes in the TMS line, one must use the previous mode of operation. As for ‘reading’ bits/bytes, its very similar, either it reads what the TDO line is, and sends that as a byte (one bit per byte), or, it reads in an entire byte serially, and sends that (8 bits per byte).

This page has some details:

http://ixo-jtag.sourceforge.net/archive … _jtag.html

Also, I think the source code for openOCD has notes from the same guy.

I believe a point of confusion (my fault for mixing up my terminology) is the phrase ‘bit bang mode’. The FT245 can run in this mode (as per the datasheet), but I was actually refering to the mode the USB blaster is in (as in the firmware CPLD, not the FT245). As described above, the blaster has two modes: Bit bang, and Byte shift. These are specific to the USB blaster, not the FT245. So, even though the FT245 can do ‘bit bang’ all by itself the blaster doesn’t use it in this mode, instead, it uses the CPLD to emulate this mode. I’m not sure whether the FT245 had this function when the blaster was originally designed, so they put a CPLD in there to do it. The added logic also allows a more efficient transfer of data if its just long serial strings of bits, making good use of the USB buses speed.

Long winded explaination I know, and you’re right, a picture is worth a thousand words (so is code!) so later on today, I’ll provide what I have :smiley:

Blueteeth