Build one, get two: CPLD and STM32 development on a single board

Programmable logic devices have claimed their place in the hobbyist world, with more and more projects showing up that feature either a CPLD or their bigger sibling, the FPGA. That place is rightfully earned — creating your own, custom digital circuitry not only adds flexibility, but opens up a whole new world of opportunities. However, this new realm can be overwhelming and scary at the same time. A great way to ease into this is combining the programmable logic with a general purpose MCU system that you already know and are comfortable with. [Just4Fun] did just that with the CPLD Fun Board, a development board connecting an Arduino compatible STM32F103 Cortex-M3 controller to an Altera MAX II CPLD.

The PCB itself has some standard development board equipment routed to the CPLD: LEDs, buttons, a seven-segment display, and additional GPIO. The rest of the CPLD’s pins are going straight to the STM32 and its SPI, I2C and UART pins. Let’s say you want to create your own SPI device. With the CPLD Fun Board, you can utilize all the pre-existing libraries on the STM32 and fully focus on the programmable logic part. Better yet, every connection from MCU to CPLD has its own pin header connection to attach your favorite measurement device for debugging. And in case you’re wondering — yes, you can attach external hardware to those connectors by setting either MCU or CPLD pins to Hi-Z.

The downside of all this is the need for proprietary design software and a dedicated programmer for the CPLD, which sadly is the everyday reality with programmable logic devices. [Just4Fun] did a great job though writing up a detailed step-by-step tutorial about setting up the environment and getting started with the board, but there are also other tutorials on getting started with CPLDs out there, in case you crave more.

13 thoughts on “Build one, get two: CPLD and STM32 development on a single board

  1. This looks like a really neat board.

    Don’t be to worried about the propriety IDE (Altera Quartus) as it’s far easier to get started with than the competitors Xilinx ISE. Number one rule for the Xilinx ISE (not used in this project) is “thou shalt not read warning messages”.

    Some things to mention though perhaps –
    The EPM240 or EMP570 CPLD used in this project is not specified to be 5 volt tolerant when using the pins as inputs from 5 volt devices without current limiting resistors. Having said that, I have mixed EPM’s that are LVTTL with 5 volt chips many times and without current limiting resistors and I have never had a problem.

    It’s good to see the layout supports both the EPM240 and EPM570.

    A 50MHz XTAL would have been good for playing with generating video outputs but without SRAM there would have to be interrupts to the micro-controller. The EPM’s don’t have a clock multiplier (PLL) and they don’t BRAM but they do have some rather slow FLASH built in. From memory you can use the FLASH clock for other things if you aren’t using the FLASH but it’s fairly slow.

    Even some basic stereo R2R DAC for audio and perhaps 4 bit DACs for Video would be nice and they perhaps could be plugin boards or shields.

    If the board is shipped with the Arduino bootloader then you only need the CPLD JTAG programmer. Both programmers are under $10 anyway.

    If you want to “cut your teeth” in Verilog, VHDL or Schematic Entry then this board is an ideal low cost entry level learning board.

    Quote: “combining the programmable logic with a general purpose MCU system that you already know”
    It’s the other way around for me. I know the CPLD/Quartus but not the STM32. If I have not already bought some STM32s recently then I would be keen on this board.

    And if your wondering … I don’t have anything to do with this project but I may have commented on it on

    1. Thanks very much!
      The 50MHz oscillator is provided on the board, but is “optional” (you decide if populate it or not) because the STM32 is used as 36/8MHz clock generator (in the photo it isn’t populated).
      About the SRAM, you are right, but as this board was intended as a beginners entry, to make things easier I preferred to add only basic stuff… (it was just only a “decision”, may be someone else would have done differently…).
      Best regards.

  2. Now, if Altera took a leaf out of the IceStorm book… I might be interested. I still get nightmares when I think about dealing with Quartus II with its insistence on locking itself to a MAC address, its idiosyncratic Linux port and the backward-inclined learning curve.

    1. Icestorm is fine if you limit yourself to a few low end Lattice Parts and run only Linux If you’re a windows user and need to user other parts it’s worthless.

      And Quartus isn’t bad. Just use a older version like 11.0 and you don’t have problems. You don’t need the latest with using older Altera parts like the EPM’s and Cyclones.

      1. It’s only worthless for other parts because the manufacturers haven’t contributed any effort to making it not-worthless. In fact, it’s only because of the effort of a few that IceStorm is worth anything.

        Likewise with IceStorm on Windows… could be done if someone wants to put the time into porting it. The code is there, all you have to do is make the necessary edits to compile it on Windows.

        Given the nature of IceStorm, I doubt this is going to be a challenging job. That said, it’ll be a job for someone other than me as I consider Windows to be a legacy OS with no future these days.

        Not sure when Quartus II v11 came out, but I recall trying to use it about 10 years ago. The Linux version refused to do anything with the FPGA board, the Windows version sort-of worked, but couldn’t make a head or a tail out of it. Both required it to be locked down to the MAC address of the machine installed, which meant I couldn’t use the uni computers, I had to use my own.

        I don’t get the silly proprietary games that the FPGA makers go on with.

  3. “The downside of all this is the need for proprietary design software and a dedicated programmer for the CPLD, which sadly is the everyday reality with programmable logic devices.”

    One of the few things people wish the Chinese would copy like mad.

  4. I am using Quatrus ver 13.0 and it supports the EPMs (MAX II) and Cyclone II III and IV.

    Version 15 does support the EPM240/570 (MAX II) but doesn’t support the Cyclone II and III which is a setback for a beginner as there are lots of very cheap Cyclone II and III boards on ebay which would be a nice “next step” after this board.

    The latest version is 17.1 and probably doesn’t support this project.

    Someone mentioned that version 11 was easier but there may be registration issues.

    I would recommend ver 13.0 because I know it works for this project and also for the cheaper cyclone II or III development boards on ebay.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s