Advanced FT232 Bit Banging – Homebrew ISP CPLD Programmer

Hello all, and welcome to another article on bit-banging the FT232 for fun and profit. Well, there’s no profit in it but at least we’ll have some fun. Today we’re going to describe the development of a simple In System Programmer (ISP) for a CPLD device.

We hope you’ve already read our first three articles on FT232 USB bit-banging, but if not – now’s a great time to go back and get some information on the fundamentals.

Down and dirty with FT232R on Arduino Diecimila

More FT232 Bit Banging with the Arduino Board

Bit Banging SPI on Arduino €™s FT232RL

Let’s first take a look at the programmer and the system we will be flashing data into. We’ve used a stock FT232RL Breakout board from SparkFun electronics and built ourselves a little 7-pin cable to connect to the CPLD board. Here’s a shot of the bench setup.

The FT232 used as a CPLD programmer

Fig 1 – The FT232 Breakout Board programming a CPLD

The CPLD we’ve used is an old one – the Lattice ispLSI2032. It’s a pretty simple, 5v CPLD with 1k gate equivlents and 32 pins/registers. Not very powerful by today’s standards but it’s plenty for what we need – a non-voltaile, flash-based, in-system programmable logic chip to replace the 74xx/40xx series. It just seems that whenever we need a 74xx, we don’t have the right one or the local stores don’t have it in stock – lame! So we’re building a general-purpose replacement module that still fits a DIP-14, 16, 24 pinout. It can replace 74xx’s and also emulate many 74xx’s all in one footprint. Kits may be available someday – the boards are ready and the system works, it’s just a matter of getting the assembly simplified. Bug us at logicsharkatopenschemesdotcom to get us moving.
But back to the task at hand – the programmer. The 2032′s programming port is a standard SPI interface with a few extra modes and an !ispEN pin to force the CPLD into ISP mode and set all the outputs tristate in preparation for reprogramming.

In our setup, we’ve brought out the 5 ISP pins as well as the GND and +5v so the CPLD can be powered by the SparkFun 5v supply while programming. NOTE: you’ll need to unsolder that 3.3v jumper on the SparkFun board and jumper it to 5v if you want to supply 5v from the USB for programming. Also note that this 5v should not be connected if your CPLD board is being powered from something else – the 5v supplies will fight. But GND always has to be connected, of course.

Here’s the diagram of our programming cable that connects the FT232 board to the CPLD’d ISP port.

The Wiring Diagram for the Programmer Cable

Fig 2 – FT232 to CPLD Connector Cable

Yes, it’s a little messy but we added RTS to nISPEN as a later revision to an existing cable. We used to have nISPEN grounded so it was always in ISP mode when the programmer was connected, but our lazy asses got bored of plugging and unplugging so we updated the code so we could always leave it plugged in. Kind of like it was designed to be used… Ha!

Here’s the pin description for the CPLD side

  • nISPEN - Bring low to enter ISP mode and tristate all CPLD pins.
  • SDI - Serial Data In to the CPLD (Programmer’s MOSI)
  • SDO - Serial Data Out of the CPLD (Programmer’s MISO)
  • GND - Connects CPLD board GND to FT232 board GND. Required!
  • VDD - 5v supply from USB. Don’t use if CPLD is powered by some other supply
  • SCLK - Serial Clock
  • MODE - Used as !CS for SPI stuff, and also used for changing ISP states
  • nRESET - Pulled high on the CPLD board so not connected here

Continued on Next Page…

This entry was posted in Hacks, Projects. Bookmark the permalink.

9 Responses to "Advanced FT232 Bit Banging – Homebrew ISP CPLD Programmer"

Leave a reply