Howdy Schemers,
We had to put the Digital Photoframe Projects on the shelf for a little while as we took care of some important business. It seems that a popular PowerPC has some problems with a very thin reset pulse. So thin that it’s often considered a reset glitch instead of a reset pulse. Oh Noes! You guys gotta take better care of your reset logic next time. Another valuable lesson learned.
Now while we don’t care one bit about how this glitcher works or what it’s used for, it is certainly interesting that the CPLD has exploded in popularity and is programmed exclusively using JTAG. Today’s lesson consists of the development of a bit-banged JTAG SVF player in order to program a device such as a CPLD. It’s quite likely that the SVF player we develop today could program an FPGA or flash a micro or some other good stuff we haven’t thought of yet – SVF is a very powerful data format. But at the moment, we’re going to stick to the task at hand – flash a bitstream to a CPLD using a homebrew JTAG interface. Our interface will use the synchronous bit-bang mode of the FT232 chip, as has been previously described in: Bit Banging SPI on Arduino’s FT232 and Lattice CPLD programmer using FT232. So let’s get to the program.
CPLD is Win
The CPLD board we’ll use for development today is the Digilent C-MOD board. This board is based upon the Xilinx XC2C64A CPLD. A CPLD (Complex Programmable Logic Device) is a programmable logic chip, smaller and a bit more streamlined than an FPGA but still fairly closely related. CPLD’s are mostly used as glue logic, or to implement smaller custom logic blocks in large designs.
CPLD’s are cool, and a worthwhile technology to have in hand because it’s REALLY nice to be able to implement a wee bit o’ custom logic without pinning out two hundred something FPGA pins. In the reset pulse tester mentioned earlier, the CPLD watches a few lines for a start of a known routine and begins shooting little reset pulses after a variable delay. If no problem is detected, the CPU is restarted with a little longer delay next time. Overall, the delay is swept over a wide range to make sure your CPU is not susceptible to the reset glitch problem.
It seems that all over the world, concerned citizens are taking it upon themselves to ensure their CPU’s are not problematic. We’re very proud to see so many non-g33k types take such an interest in supporting robust logic design, especially in the usually ignored categories of brownout and short pulse protection. Kudos! It seems that pretty much any board with an XC2C64A has been flying off the shelves, often into the hands of an average joe who simply isn’t interested in the headaches (read: FUN) associated with home bringup of programmable logic.
A common complaint is that folks are buying the CMOD or other compatible boards without having a programmer handy. Darn! The second most common (or related) complaint is that most PC’s manufactured after 1985 don’t have a parallel port. That’s an unfortunate situation, having a fancy new toy and not being able to twiddle around with it.
We decided that it’s time to lower the barrier to entry on homebrew JTAG’ing Xilinx chips, and the best way to do that would be to take that stupid LPT wiggler and send it back to hell where it came from. You want bit banging, you want USB convenience, and you want your programming jig to supply power to the target device. Done, done, and done. FT232.
Notice we said FT232, NOT FT2232. That is +FT232 -FT2232 in googspeak and please don’t even ask if a 2232 version is in the works. There’s a million projects that use the pre-packaged MPSSE mode of FT2232 to do all sorts of stuff way cooler than this. This article is taking it back to the old school, and bringing a JTAG SVF player to the good old fashioned synchronous bit bang chip available on every arduino board on the planet.
What’s in store for you today? You will learn how to traverse the standard JTAG TAP state machine in software, how to read and interpret the SVF file format, and how to churn data from your PC’s cozy USB port to the cold world of JTAG serial port using handcrafted square waves.
Jump to Page 2






Link for the Openschemes_FT232_SVF_Player appears to be broken.
The link is working.
The software doesnt works. Firstly, it requires to have directory c:/temp created. I figured that out using procmon. Now, it doesnt detects my ft232r (No Interfaces yet.. in interfaces list). I’m sure that FT232R is connected and configured: I can use it with my terminal. I tryed both kinds of drivers: D2xx and VCP with no success. I’m runnung windows 7 OS. It would be great, If you figure out what is happening and fix the program. Thanks.
Good catch on the temp directory, a corrected version will be up soon. As far as the device description, what was the device description you had that did not contain FT232R? It would be dangerous to open it up to any interface, but easy to add another or a few more descriptions of common boards.
It was my own board, so I had description field filled with my product’s name.
Oh, The problem was in device description. It has to contain “FT232R” string. Thank you!
the nextstate array is wrong.
0×0: Test-logic-reset 0 1
0×1: Run-test/Idle 1 0
0×2: Select-DR-scan 3 9
should be
0×0: Test-logic-reset 1 0
0×1: Run-test/Idle 1 2
0×2: Select-DR-scan 3 9
Chears
Good eye! Rest assured that the code is right, it just didn’t get translated to the text. The text is now updated.
Hi, does it work with FT232BM? Interface has been recognized, but none activity on selected signals..p.
Good question. We’ve looked it up on the FTDI page, and it seems that FT232B does NOT have bit bang mode. FT232R does have it.
..FT232BM does support bitbang mode – ie see app note AN232BM-01 (..”The purpose of this mode was intended to be used to program FPGA devices..” y2002). Would be nice to get it working..There is a lot of modules around..p.
Good find – we stand corrected. It looks like the BM device contains a non-synchronous bit bang mode. With a little work, the tool could probably be adapted to use this FT232BM device, but the speed might be slower. Give it a try!
..and the FT245BM (parallel FIFO bi-directional data transfer up to 1MB/sec).. also worth considering. And much easier to solder
. Thanks.
success! i wanted to tell you that with this instruction i was able to ‘tag my [device]. thank you!
Glad to hear that it worked for you. Your comment has been cleaned a little, to remove identifying remarks. So what CPLD did you use?
I have a question – does this software work with FT2232? Is FT2232 faster?
No, just FT232. There’s a million tools for jtag with 2232.
For me, there wasn’t any broken piece of metal. It was a screw that was ssupoped to hold down the circuit board, just rolling around loose. All the other screws on that card were also loose. Tightened them and re-installed the loose one. Now maybe it won’t be the cause of any more unexpected freezes and resets. Thanks for the help in getting the case opened.Funny, just last week found a loose screw in our InFocus projector. That one let heat out of the lamp assembly, shutting the unit off!
It works with XC9572XL!!! Thank you!!!!
I will programing a Xc2c64a chip.
I receive always this faliure
here is a log
“Opening c:\temp\falcon.svf
> // Created using Xilinx Cse Software [Lab Tools - 13.2]
> // Date: Mon Sep 26 14:40:05 2011
> TRST OFF;
No control over RST, ignoring
> ENDIR IDLE;
Set IR end state to IDLE
> ENDDR IDLE;
Set DR end state to IDLE
> STATE RESET;
> STATE IDLE;
> FREQUENCY 1E6 HZ;
My frequency is very low, ignoring this directive..
> //Operation: Program -p 0 -e -v
> TIR 0 ;
0 leading IR bits OK
> HIR 0 ;
0 trailing IR bits OK
> TDR 0 ;
0 leading DR bits OK
> HDR 0 ;
0 trailing DR bits OK
> TIR 0 ;
0 leading IR bits OK
> HIR 0 ;
0 trailing IR bits OK
> HDR 0 ;
0 trailing DR bits OK
> TDR 0 ;
0 leading DR bits OK
> //Loading device with ‘idcode’ instruction.
> SIR 8 TDI (01) SMASK (ff) ;
lNumBytes= 24
Sent: 01
Got: 00
> SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f6e5f093) MASK (0fff8fff) ;
lNumBytes= 96
Sent: 00000000
Got: 00000000
Masked Expectation: 06E58093, Masked Result: 00000000 Fail! Bailing out…
”
Waht is the problem?
Can you help me?
You are only receiving 0′s for any communication. Your wiring is not connected properly, or your pin selection is wrong.