I would like to know if anyone has interfaced a CPLD or FPGA with the Arduino? I love the Arduino but would like to get some experience with a CPLD or FPGA. Does anyone have any ideas?
Rico Bravo

Hi Rico,

I’m thinking of doing something along these lines…what are you interested in using it for?

I'm not familiar with CPLDs, but FPGAs frequently have more resources than a microcontroller like the arduino. In fact, one common tool is to implement one or more microprocessors on the FPGA along with custom logic to create an embedded system.

One lab assignment for our students is to interface an FPGA with an I2C temperature sensor (DS1620 or 1621, IIRC).

There are IP cores, including many open source, available for FPGAs so that one could easily make an I2C or SPI peripheral interface to the arduino.

With the typical FPGA's hundreds of pins, one could probably make an impressive (and expensive) LED display. :slight_smile:


I have a lot of experience with FPGAs and CPLDs. They are very useful things for implementing your own simple custom logic up to more complex things like DSPs, ethernet MACs, digital filters etc. It is entirely feasible to implement the entire Arduino boad, USB interface and all, inside a single FPGA.

The two biggest manufacturers are Xilinx http://www.xilinx.com and Altera http://www.altera.com . The devices they offer perform essentially the same functions at a higher level but are fundamentally different in their internal structure. Both companies offer free development suites for download which are a good way to get started, but be warned! I think they weigh in at over 1GB each...

However there are a few barriers to getting started, some of them lower than others:

  1. Cost - most CPLD and FPGA devices are relatively expensive in small volume, especially large, modern FPGAs. Futurlec.com has some small Altera and Xilinx CPLDs in the $3 to $12 range but you could struggle to fit a complex design into these devices. They're good for address decoders, mopping up external 74HC type logic devices, simple interfaces and state machines and other simple functions.

  2. Programming - they all need to be programmed usually using a JTAG programmer which is usually specific to the manufacturer of the device and usually costs a couple of hundred $. But you can find schematics etc to make your own simple programmer on the internet for some devices (I have made my own parallel port Xilinx programmer based on their own design).

  3. Development tools - The free tools don't let you use the latest and greatest devices, but have a large selection that should be enough to get started. The paid-for versions offer more, but you probably won't need it all when getting started. The simulators they provide are fairly good and can allow you to simulate your entire design before testing it in hardware, but this requires more programming effort.

  4. Device Packages - You won't find a CPLD or FPGA in a DIP package. PLCC maybe for an old device, anything else will be in a high density QFP, TQFP or BGA package. Most devices off lots of I/O pins and this quickly becomes a problem with DIP packages. This means that you're almost certain to have to have a custom PCB made up when using a FPGA or CPLD, or at least use an adaptor board.

  5. Mixed Voltages - a lot of the newer CPLDs and FPGAs require 3.3V supplies or lower or even multiple supplies which can increase complexity. Also a lot of the newer (and not so new) FPGAs are NOT 5V tolerant, requiring care when interfacing with something like Arduino.

  6. Programming language - VHDL is a common design language to use, it is somewhat like C and isn't too hard to pick up but it is different and has it quirks, like strong type checking which can complicate what should be simple tasks! You can draw your designs schematically with the development tools but this becomes hard to manage once a design becomes complex, using VHDL or Verilog is recommended.

  7. Closed source - The development tools are manufacturer specific, ie Xilinx can't do Altera and vice verca, not open source and are written for the Windows platform. I think there is a version of the Xilinx ISE that runs under Linux, but there is definately no version for the Mac. You could try running it under an emulator on an Intel Mac - let me know if it works! You can develop your entire design using open source 3rd party editors outside the development environment (emacs has a brilliant VHDL mode!) but at some point you need to bring it into the sythesis and place and route tool which is specific to the manufacturer and there is no open source equivalent that I know of.

Opencores http://opencores.org/ is a good site for looking at what open source FPGA stuff exists including many pre-tested open source IP cores you can plonk right into your own design.

Having said all that, it should be relatively simple to get started with FPGAs and CPLDs and use them with the Arduino board. The best way I can think of would be to visit Xilinx and Altera and take a look at their starter kits. These contain a development board with a CPLD or FPGA, some interfacing bits and pieces, usually a programming cable or interface of some description, LEDs, LCDs, buttons etc and some software - ie enough to get you going. Just remember to check if the FPGA or CPLD is 5V tolerant!

Xilinx starter kits begin at US$40 or so for a CoolRunner-II CPLD kit and go up past US$2000 for the latest Virtex 6 FPGA boards. You may find this is less with educational discount.

Digilent http://www.digilentinc.com/ do some Xilinx Spartan FPGA boards starting at US$59 with academic discount, and some of these boards are the ones Xilinx uses with industry in its professional FPGA training sessions.

So I recommend getting a starter kit of some kind, downloading the free development suite and go from there. There are usually tutorials included with the development software, on the manufacturer's websites and other places on the net to learn more.

they all need to be programmed usually using a JTAG programmer

The last time I had a limited exposure to FPGAs (several years ago), there seemed to be a trend toward having devices load up their configuration from a serial EEPROM upon reset. Did that trend die? It would seem like a good way for hobbyists to experiment more cheaply.


Yes, some devices require an external configuration memory, but some devices now integrate the configuration memory into the device. The Altera MaxII is an example of a SRAM based CPLD with built in configuration memory.

Either way, you still need some way to program an external configuration memory or program the device directly.

You could use an Arduino with some appropriate software to program a serial memory device, or alternatively the Arduino could emulate a JTAG interface to directly program a device, but either way would require some software on the Arduino and the host PC to download the data - and the programming protocol is likely to be different, at least for different manufacturers so this is not a trivial exercise.

I have, in the past, written a driver to program a Xilinx Virtex device using an embedded Power PC running VxWorks, but the size of the memory in the Arduino makes this more difficult.

I think that some of the FPGA starter kits I indicated have on-board programming hardware so all you need is a USB cable and the supplied Windows software to configure them - that's got to be the easiest way to get your toes wet in the world of FPGAs.

The Altera DE-II educational board contains the JTAG interface as well - only a USB cable is needed. It's got an array of buttons, displays, and interfaces (going by memory, could be inaccurate: discrete LED, 7-segment, LCD, VGA, composite video, audio in/out, SD card slot, ethernet , rs232, USB peripheral, USB host, etc). IIRC, price is in the US$300 range.


Ok, I'm glad my post broke this topic wide open. I'm actually 99% done with the schematics for a shield board, so have done a fair amount of research. Let me try to address some of the points brought up:

  1. COST. You are right. Cost basically rules out FPGAs. We don't want the shield to cost 10x more then the Arduino. In fact, we don't want to implement an entire uC in the device anyway; the idea is to help the AVR not replace it. Actually, I considered replacing it :-), but in fact AVR+CPLD is cheaper then a big FPGA...not even counting the software effort it would take to actually make an AVR compatible FPGA.

2/6. Programming/ Programming language, etc - Yes, this is a barrier. I noticed that Lattice offers free source code for an "embedded" programmer, so am wondering if this can be used to make the Arduino itself capable of programming the device... and as you mention, there are DIY programmers out there.

  1. Dev tools - To hit the Arduino crowd's (hobby/toy) price point we can't really use the latest and greatest devices anyway...

  2. Packages - Yes, SMT only. The community seems to be branching out a little into both DIP-breadboard projects AND SMT-shield projects. Arduino Pro, lillypad, mega, etc are all using SMT.

  3. Mixed Voltages - I choose the Lattice ispMACH 4000V because of its 5v tolerance. But I am concerned about the price/size ratio. It turns out that we really only need a few pins (essentially the 4 SPI pins) going from Arduino to CPLD, so voltage dividers could easily be used. Perhaps I should move to the ispMACH XO?

  4. Closed source -- Yes, the dev tools dont run on all platforms. But they are free (for some devices)! And you have to learn a HW design language. I would hope that there would be some guys doing designs, and a lot of other guys just using the designs.

@letaage -- I was only considering Non-volatile devices to avoid having to deal with another SMT part and multi-chip JTAG scan chains, etc. Is there a significant density or price advantage to a 2 chip approach?

WRT embedded programmers, do you think that this problem could be solved by using the Arduino just as a pass through (laptop -> USB -> AVR -> CPLD) -- but the data and hopefully a lot of logic could actually sit on the laptop?

@kg4wsv -- By your comments you seem to be in education. I was hoping that the board could hit a price point that would fit hardware design courses. Do you think that the typical intro hardware design problem sets would fit into a 64 or 128 macrocell device?

Also, do you think that the combination of uC and CPLD might make this something more useful in the classroom? Personally, I think that it is cooler since it mimics more closely a big machine. And I also found the diligent board sort of boring -- I think because while a CPLD is great at some things, it is not so good at stuff that gets the device out of the lab. Like having an embedded web server or posting updates to Twitter...

I have only done simple HW designs. But here are my ideas as to why it would be useful in an Arduino environment:

In terms of uses, it seems like one CPLD can take the place of some of the logic portion of some special purpose chips that people are using. Here are my ideas:

  1. 5 to 3 volt converter (I thought to use a 5V tolerant CPLD)
  2. IO multiplexer/demultiplexer (of course, the new MEGA on the 1280 has a lot of IOs...)
  3. Interrupt multiplexer

Then there is basic logic that can be implemented in the CPLD. This logic could also be implemented in the AVR of course, but some of them are more efficiently done in a non-Von Neumann hardware architecture.

4 Button state sensing debouncing
5 Simple logic around other sensors (IR for example), like filtering false signal.
6 Stepper motor control (LOTS of motors)
7. USB to serial (may not fit)

Then there is some stuff that would benefit from a high clock rate:
8. PWM outputs
9. therefore LED brightness drivers (but not power LEDs)
10. LED matrix controllers > 8x8
11. Video signal driver (I haven't really looked into it; but without a DAC this might not really work -- could you use PWM and an inductor to smooth out the signal?)

Other ideas welcome! If anyone wants to help out I'd appreciate any feedback...

@kg4wsv -- By your comments you seem to be in education.

Yep. Caveat: I'm a support guy, not a prof.

I was hoping that the board could hit a price point that would fit hardware design courses. Do you think that the typical intro hardware design problem sets would fit into a 64 or 128 macrocell device?

The price point is OK. We use configurable logic mostly in 2 places: intro to digital logic, and a senior level reconfigurable computing course. The sophomore level digital logic course is either using the retired boards from the upper level class, or using some small boards, or maybe doing all the reconfigurable work in software and stopping with a simulation. In any case we stick with the same software suite in both labs so that the student can spend more time coming to grips with the concepts they need to learn and less time learning how to make the software do what they want.

Like I said, we can get the DE2 (not DE-II like I said earlier) for somewhere around US$300, and it is robust enough to last for several years. It has enough resources to implement the NIOS microprocessor core (provided by Altera) if we want to integrate microcontroller work. Most of the FPGA interfacing is driving external peripherals (e.h. interface to an I2C temp sensor and display the temperature on the DE2 7 segment LED).

We have used custom hardware in the past (for a microcontroller course), but it was designed to meet the specific requirements of that course/instructor.

for programming, I suspect you'd end up with a JTAG interface on the shield for separate programming of the CPLD. (I think the DE2 uses an FTDI FT245, parallel sibling of the FT232 serial device on the arduino, as a JTAG interface). You'd have to have some hardware support (pins) and a reasonable amount of software on the arduino to use it for programming.

In general, I like the idea. For academic use, it really depends on it meeting the needs of a particular academic program. I'm not sure it fits ours, but that's a sample size of 1.


A couple of quick thoughts on the uC+CPLD combo...

Video is probably out because you'd need some sort of frame buffer, since there's no address and data bus on the Arduino. But, if the "C" in your CPLD is big enough, you could do the frame buffer as a RAM add-on, and load it through the CPLD. If video is a likely to be a major application, consider building an AVR with an external bus onto the board. Then you can persuade a few of your sharper students to take on porting the Arduino run-time to it as a term project :slight_smile:

It's very likely that people will want to do some additional circuitry, like power drivers for LEDs and motors. Make sure your design is breadboard-friendly. If your interface to the Arduino is going to be SPI-based, you should even consider not trying to do it as a shield: it would give you more layout flexibility, and allow people to use the board with 68HC11s and more-complex micros (like ARMs) that have SPI interfaces.


This is my first post, so please take it easy on me for bringing up an old subject.

Has there been anymore talk of using a CPLD/FPGA with arduino? Either as a sheild or in a way the can quickly/easily be hooked up to an arduino board.

Thank you to the arduino team and arduino community for all your previous work. I'm hooked on the arduino platform.

I have an old DeVry eSOC board that has an Altera MAX EPM7128SLC86-15 in it. It has been helpful to me in designing and testing circuits for parts I dont have. (Various ICs and custom Digital Logic)

Is there an interest in seeing an ATMEGA644 and a Similar Altera chip on the same board? If so I need some manufacturing help as I would like the price to be under $50.

Thank you,
J.C. Woltz

I'm not sure how fresh this thread is, but I'd be very interested to find out what work the Arduino community has done regarding FPGA. My gut feeling is that it is theoretically possible, no doubt someone actually has done it, but it is almost certainly not commercially viable.

As for CPLDs with Arduino, I don't see why not. In 1998, I successfully completed a University project that used an Atmel AVR with a Lattice CPLD. Both parts were programmable in system via dedicated interfaces which I'd attached to a PIC16C54 to act as an embedded programmer over RS232. It was a lot of work!

This is slightly off topic - but I was reading about FPGAs a while back and came across this site:


Seems it provides a nice introduction to the subject for beginners.

There's also a shop for sourcing development boards:


For those on here with FPGA experience, does anyone know or understand what happenned in regard to Hugo De Garis' project of the "CAM-Brain Machine" (CBM)?

I followed it for a while (and as far as I have been able to find out, actual hardware was created), but the last mention of it by De Garis is that funding ran out, and the particular Xilinx FPGA he was using had the production ended, and other versions/types that they made wouldn't work for the project.

For those that don't know, the CAM-Brain Machine (CBM) was a project done by De Garis to create an evolvable (using genetic algorithms) neural network. The network was implemented on the FPGAs (hardware NN), but the evolution took place on (for the time) high-powered workstations, which would "evolve" the interconnections of the neural net, then upload the code to the FPGAs in the machine itself.

It was a very ambitious project (and it had one hella sexy looking chassis); the goal was to evolve the level of a cats brain (and use it to control an Aibo-type quadruped robot name "Robonoko", IIRC) - then eventually use the technology to work up to human-level numbers of neurons/interconnects (synapses).

Its like the whole thing dissappeared off the planet sometime around the year 2000; some thought it was a scam, but from what I know from the sources I have seen, ITR in Japan got hardware, as well as StarLabs in Brussels (both of these machines were one-off hand-built devices). They apparently worked, but perhaps not as well as the creator had hoped, which may be the primary reason the project fizzled out (they had managed to evolve a few neural nets that performed some simple tasks like tone recognition and the like).

I've just always been curious on the FPGA angle of the research; what made the FPGAs they used so special compared to others? Maybe they could be programmed quicker? Maybe they didn't wear out with reprogramming? I don't know.

Artificial Intelligence, research, development, etc - its a minor hobby and interest of mine, and the idea of using GAs to evolve a neural network resonated with me. Last I read about De Garis, he had moved to take a position at a university in China to pursue more development on the CBM concept with funding from the Chinese government.

At a certain level, his ideas, implementations, constructions, setbacks, funding, etc - all remind me of the struggles and such Charles Babbage went through (and ultimately failing to acheive his goal, which would have to wait another century to be implemented, even though realistically, we now know the technology of his day was more than suitable and accurate enough to construct his machines - and his ideas anticipated everything that the Harvard Mark 1 became - Howard Aiken even said that had Babbage been born a little later, he would have been out of a job).

My last thought on this: By not pursuing or funding hardware-based, evolved neural network technology, are we (humankind?) in essence make the same mistake the British did with Babbage (and later, to a certain extent, the German government did with Konrad Zuse!)? These kinds of thoughts "keep me up at night" - the thought of certain ideas and technologies that mankind is glossing over saying "they won't work", when in reality - they could - provided just a bit more effort and knowledge were placed on implementing them...


Hello! I've created a CPLD-based Arduino-compatable controller that can act as a shield or be stand alone. I'm opening it up for beta testing for those who are interested. Please visit my site for more details and to get involved in testing: http://majolsurf.net/wordpress

The Amani 64:

In short, The Amani 64 is a low-cost entry-level CPLD development kit, stackable with the Arduino, other Amanis, and Arduino-compatible shields. As the project grows, higher-density variants of the board will become available, including FPGAs. Also available for test are application-specific interface modules as well as a low-cost USB-based JTAG programmer. While the Amani 64 is only a 64 logic cell device, I have found it to be quite useful as a stand-alone board as well as supplement to the Arduino in various projects I'm doing thus far. The board is "multi-stackable" thus allowing for a data-bus to be created between the Arduino, multiple Amanis, and shields on the PB/PD connectors.

I'm pretty excited about it and think Arduino fans will be too. I'm happy to be in the beta test phase so I can get feedback from folks in the field and free up my time to play with it more. Please contact me if you are interested! Thanks!

You could use an Arduino with some appropriate software to program a serial memory device, or alternatively the Arduino could emulate a JTAG interface to directly program a device, but either way would require some software on the Arduino and the host PC to download the data - and the programming protocol is likely to be different, at least for different manufacturers so this is not a trivial exercise.

Using the Arduino as a JTAG programmer is possible and a good idea, provided you are willing to change the VID/PID on the FTDI chip to make the Arduino board appear to the Altera/Xilinx programming software to be the appropriate JTAG programmer. For example for Altera you would have to make the Arduino appear to Quartus II to be the Altera USB-Blaster. This no longer makes the Arduino an Arduino until the FTDI is reflashed. I suppose you could use the Arduino to read pof files over USB and program the FPGA that way.

A cheaper method was developed by Kolja Waschk http://www.ixo.de/ who developed code for both an FX2 and an Altera CPLD to create a USB JTAG adapter. In fact, if you open an Altera USB-Blaster, you'll notice that it is essentially an FTDI FT245RL USB FIFO coupled with an Altera CPLD. I built a little cpld version of the Altera USB-Blaster and loaded a modified version of Kolja's code and it is what I use to program my boards. Something like this can be built for about $30, provided you have SMD soldering skills. I've noticed many student engineers build FPGA-based boards with the FX2 approach.

Very interesting project. Will definitely keep an eye on it!

Also, check out: