Ghetto Programmable Logic (CPLD) Development System




Introduction: Ghetto Programmable Logic (CPLD) Development System

For the past several months I have been enjoying the Ghetto Development System for the AVR processors. In fact, this nearly zero dollar tool has proven so fascinating and useful that it got me wondering if it were possible to extend the concept to FPGA/CPLD development as well. (FPGA: Field Programmable Gate Array. CPLD: Complex Programmable Logic Device.)

So I did a little digging on the web and came up with a development system for Atmel CPLDs. Comparison with Altera devices shows their pinout to be the same (within the restrictions I detail below), so they'll work also. By building the development board and interface cable I'll present, then downloading the tools, you can develop your own CPLD applications.

Please note the following limitations and restrictions. I've tried to balance capability and simplicity so you can build something that you'll enjoy and learn from.
5V devices only. Extending the system to cover additional voltages (3.3V, 2.5V, 1.8V are supported by Atmel devices in the same family) is not difficult, but it complicates both the development board and the programming cable. Let's skip it for now. Note that you have to provide a 5V supply to the board.
44 pin PLCC only. Specifically, I've programmed the Atmel ATF1504AS. The Ghetto CPLD concept can be easily extended to other Atmel devices, but this device seemed like a good compromise between price, ease of use, and capability. The concept should also extend to other devices such as those from Altera, Xilinx, Actel, etc. In fact, the Max7000 family EPM7032 and EPM7064 will work in the same socket as long as you use the 44 pin PLCC versions. So far I've only used the Atmel programming cable, but the Altera Byte-Blaster is supported by the Atmel software and should also work fine. It's actually a little simpler design than the Atmel cable. (I built the Atmel version and it works, so I haven't tried the Altera version.) SparkFun offers a $15 version of the Altera cable. Since this will work for both Atmel and Altera, I recommend it. If you're going to develop with Altera parts, you'll want to get the Altera software as well. I haven't actually tried this, but there's no reason I can think of that it wouldn't work.
Speed is limited. Since the Ghetto CPLD Development System is built with hand wiring and no ground plane, don't expect reliable operation at speeds over a few megahertz. Even that's not guaranteed  your mileage may vary! Of course, if you build prototype hardware that has a ground plane then your CPLD may work just fine at higher speeds. Just don't expect it to go fast mounted in the Ghetto Development System.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Go Order Parts

You'll need a 44 pin plcc socket, some decoupling caps, some unprogrammed CPLDs, sockets for breadboard connections, a pull-up resistor and maybe some perf board to build it on. If you have any of this in your junk box you can save a few bucks.

For your convenience, here are Digikey Part Numbers:
CAP ELECT 10UF 50V SU BI-POLAR PN: P1280-ND Qty: 1, C1
CAP CER .10UF 50V 20% DISC RAD PN: 478-4275-1-ND Qty: 4, C2-C5
PC BOARD FR4 1-SIDE PPH 4.0X4.0 PN: V2010-ND

A few parts may have minimum quantities, but should still be pretty cheap.

If you want to build some blinkenlights (Step 8) or make a set of switches (step 9) you may want to order these also. Keep in mind that Digikey has a $25 minimum to avoid a handling charge, so you might want to get a couple of extra unprogrammed CPLDs or an AVR processor or two just for fun.

I recommend you buy the Altera programming cable from SparkFun. Here are the part numbers. Get the cable and connector as well. (Otherwise, order parts for the cable from Digikey if you're building your own.)
Altera FPGA Compatible Programmer PN: PGM-08705
2x5 Pin IDC Ribbon Cable PN: PRT-08535
2x5 Pin Shrouded Header PN: PRT-08506

Step 2: Get and Install Software

I'm currently using the Atmel Prochip Designer 5.0 tool chain. This tool requires that you register with Atmel and fill out their official request form. I told them I was a design engineer, currently unemployed, and my primary purpose was to learn their devices and VHDL (all true, BTW). They approved the license request. The only catch is that the license is good for only 6 months. I'm hoping to find a public domain tool chain by the time it expires. Altera also has a tool chain I may check out. Any suggestions will be appreciated. See comments and links in the last step.

The Atmel Prochip Designer 5.0 is here. If you get it, be sure to get the Service Pack 1 for it as well.

Step 3: Make Programming Cable

The easiest approach here is to buy the Altera Byte-Blaster work-alike from Sparkfun (see Step 1). If $15 is more than you care to spend, then you can use the SparkFun Altera Cable schematic or use the Atmel Cable schematic and scratch-build one. (If there's a lot of interest in scratch-building the cable, I can offer some suggestions, but the Sparkfun kit seems like the right answer to me.)

Step 4: Make Programmer Cradle

Have a look at the Atmel programmer. This is very flexible and is a great option if you have the bucks and plan to do a lot of CPLD development. Altera offers something similar, I believe. But I went with a cheaper approach - that's what this is all about!
The pictures show front and rear views of the cradle I built. Note the DIP sockets used as breadboard connectors. All pins on one side of each connector are connected to ground; pins on the other side connect to signal pins on the CPLD. I included a few power connections as well; put these in where they fit. The diagrams are sort of pictorial schematics; only the extra power connections aren't shown. Look at the pictures for ideas on these.

Step 5: Building the Cradle - Part 1

Start building the cradle by inserting the sockets in the locations where you want them. Allow a vacant row or two so there will be room for the decoupling caps. This also makes it easier to connect to the CPLD signal pins.

Anchor the sockets with a bit of solder or epoxy depending on the type of perf board you use. Allow some extra room at the top (above pin 1 of the CPLD socket) for the JTAG connector and the power connector. Refer to the pictures of the one I built.

Route a bare wire (20 gauge or so) around the outside of the sockets for a ground bus. Route the power bus also. (The red wire in the pictures.) Refer to the pictures for some guidance, but your board will probably be a little different - and that's just fine.

Solder the outside pins of the sockets to the ground bus. This will help anchor the bus wire.

Step 6: Building the Cradle - Part 2

Install the decoupling caps and connect them to the ground and power pins on each side of the CPLD socket. I suggest routing the wires up and over the outer rows of pins to reach the inner rows. Refer to the pin number diagrams to get the correct pins - the pin-out of the CPLD socket is far from obvious. Leave enough room to allow connection to any pins you pass wires over.

Once the cap connections are done, connect the power and ground bus. All the red pins on the diagrams are Vcc and should be connected. The black pins are ground and should be connected also. Again, routing it in the air is a good approach. Look at the pictures for ideas.

Step 7: Building the Cradle - Conclusion

Route the JTAG connections to the correct pins. Have a look at your Programming Cable to be sure the connector is oriented correctly. Don't forget the pull-up on the TDO pin. This is shown in the picture only and goes between the TDO pin and Vcc.

The last step is to connect each I/O pin of the CPLD to a pin on the sockets. Use the numbers in the diagrams for the connections. This takes the longest time! If you follow my numbering scheme, then you can use the Top View diagram as a guide when hooking up your circuits. You really don't have to hook up all of these initially  you can wait until you need them for the circuits you design.

Check your work carefully. Be sure power and ground aren't shorted!

Step 8: Make Blinkenlights (TTL Version)

You'll want to see your circuits work, of course. So you'll want some blinkenlights (made famous by The Real Elliot).

The only catch is that CPLDs don't have the beefy outputs that the AVR processors have. Use LEDs rated for 10ma and use 1KOhm series resistors. These will give you clear output signals without straining the CPLD outputs.

Step 9: Make Switches

To provide stimuli for your circuits, you'll need some switches. You have some options here, but the requirements are different than for AVR processors. The CPLD outputs don't have the built-in pull-ups and it's not so easy to do debouncing in software. (It's possible, but takes resources you probably want to use in your circuits.) The DIP switches shown provide several switches in a convenient package, but have to be pulled up. I used 1K pull-ups.

Pushbutttons can be made using the circuit Atmel recommends for their demo board. Schematics are on page 36 or so.

Another option is to hook up an AVR processor to provide stimuli - and even check responses. But that's an exercise left to the student.

Step 10: Create Your First Circuit

By this time you should have obtained and installed the software. Follow the thorough, detailed tutorial to create your first simple CPLD circuit (two-input AND gate; doesn't get much simpler). Be sure to select the correct device (44 Pin PLCC, 5V, 1504AS [details]) and pick I/O pin numbers that are available (I used 14 and 16 as inputs; 28 as an output). These details differ slightly from the tutorial, but shouldn't give you any trouble.

Step 11: Program Your First CPLD

Hook up your programming cable to the parallel port on your PC , hook it to your Programmer Cradle, hook up 5 Volts to the Power connector and follow the tutorial to actually program your very first CPLD. Select the correct version of cable. Note that the Altera Byte-Blaster is one of the options.

Step 12: Test Your Programmed Part!

Disconnect your Programming Cable from the cradle. Plug in the switches and blinkenlights to the correct pins, turn on the power, and try it out. Since you're starting with a simple circuit, testing isn't a big challenge. If it works, you're off and running!

The top view diagram will guide you in connecting your switches and blinkenlights for testing.

Step 13: The End and Some Web Resources

It is not the purpose of this tutorial to teach you how to use VHDL. (I'm just starting to learn  that's why I created the programmer, remember?) That said, I've found several very helpful tutorials and some useful resources that I can point you toward. Feedback and other suggestions are greatly appreciated.

Note that you can also use the Ghetto CPLD Development System to learn Verilog and other CPLD programming techniques  the hardware doesn't care.

VHDL Resources on the Web:

Basics and some links here and here.

Links to free tools.

Tutorials I like are here and here, but you'll find lots of others.

Finally (for now), you'll want to check out the discussion group.

Enjoy, learn a lot, and share what you know.

Be the First to Share


    • Magnets Challenge

      Magnets Challenge
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    9 Discussions


    9 years ago on Step 5

    please please please please provide a schematic of this thing, that solder monster is ugly and hard to understand what connects to what... please!!!


    Reply 9 years ago on Step 5

    Click on the diagram to view it. Simply connect the pins by number. That is, pin 40 on the part socket goes to the pin labeled 40 on the interface socket. I'm not sure what more information a schematic could add.

    I could design a circuit board for this if that would be helpful, but I think it's the idea of a programming socket that's valuable - folks can build one to suit their own needs given the concept.

    My plan is to work on finding the public domain tool chain - nearly two years after I wrote this, I still don't think there is one.


    Reply 9 years ago on Step 5

    Thanks for the quick feedback.

    The PLCC pins to the breakout headers is the easy part, I was referring to the capacitor (the non-decoupling one) and the VCC and Power pins.

    And could you confim the programming aspect a bit. Does the ByteBlaster supply the voltage to the CPLD? You indicated that we need to connect a 5V power source. I take it that is not coming from the ByteBlaster.

    Have you looked in to WinCUPL by Atmel? Or by public domain do you mean open source?



    Reply 9 years ago on Step 5

    Thank you for your continued interest! Hopefully, I can answer your questions. The only capacitors are for decoupling. There are 4 near the CPLD Socket (0.1uF) on each VCC/ground pin pair. There is one bulk decoupling (10uF or greater) between VCC and ground near the VCC connection. The only other component is the resistor. You do need to provide an independent power connector to the board, it actually powers the JTAG programmer (ByteBlaster) as I recall. Since doing this project, I've found sources for building really inexpensive circuit boards. My next version of this will feature such a board and we'll get rid of this soldering nightmare! Finally, my search for an open source tool chain is focused on finding VHDL or Verilog tools. I'd like to find tools that are vendor-independent as much as possible (except for the fitter/synthesis part). Truly open-source is preferred, but finding free (as in beer) with non-expiring license would be acceptable.


    Reply 9 years ago on Step 5

    Thanks for clearing that up and look forward to seeing the next version.

    yim bunchhat
    yim bunchhat

    9 years ago on Introduction

    It good for me in the first time. But i need to borrow the computer desktop from my friend because it have parallel port. would you mind if i want you to tell me about USB port  please.


    10 years ago on Step 5

    nice project, but terrible soldering.


    10 years ago on Step 3

    On the spark fun schematic, are capacitors C1 to C7 needed? It would make a PCB design much easier.

    Great tutorial by the way


    Reply 10 years ago on Step 3

    C4 & C5 are decoupling for the ICs and should definitely be kept. The others work with the 100 Ohm resistors to filter high frequencies. They increase the reliability of the communications. Not absolutely required, but they reduce the chance of gremlins and possible unreliable operation.

    Glad you enjoyed the Instructable.