Ok so you’ve got your Quartus II software installed and you’re ready to start programming. I should note at this point that I will only be covering the schematic entry method of programming your CPLD. I will not be covering Verilog or VHDL in this guide.
Let’s start by running Quartus II and taking a look at the interface. Double click the Quartus II icon on your desktop and the program will open to the following screen. Click the “New Project Wizard” button in the middle of the screen. A new windows will open up with an introduction to the project wizard. Just click “Next”.
The next screen will ask where you’d like to create the new project. You can choose any location you like. You also give the project a name on this screen. I’m going to call mine LED1.
The next screen asks if you’d like to add any design files. We’re not adding any at this point so just click “Next” again.
The next screen to greet you is one we need to look at more closely. This is the screen where we configure the CPLD or FPGA chip that we’re using. In my case, I’ve got an Altera MAX II so I select “MAX II” in the Family drop down menu.
Once you’ve selected the correct family, you then have to select the chip you’re using on your development board. I my case, it’s an EPM240T100C5. You’ll need to read the code from the top of your CPLD to find yours. Once you’re happy with your selection, click the “Next” button again.
The following screen is for the EDA tool settings. I never touch this so just click “Next” and then click the “Finish” button on the following page.
The screen will then look like the image to the right. Click on the “New file” button at the top left (I’ve drawn a red circle around it). A new window will open up with a whole multitude of different options. For now, just click “Block Diagram/Schematic File” under the “Design Files” section. I’ve drawn an arrow on the image below. Then click the OK button.
The main window of the software will now show a dot grid. This is where we will be placing our logic gates and pin connectors. Let’s have a look at some of the buttons we’ll be using. Please click the image to enlarge it.
1 – Symbol Tool, 2 – Pin Tool, 3 – Start Compilation, 4 – Pin Planner, 5 – Programmer.
For now, click the Symbol tool to bring up the following window and navigate down to the “primatives” folder.
Inside this folder you will find all the sub folders for standard logic functions as well as other important items. Spend a few minutes looking through all the sub folders to familiarize yourself with what’s available and where. For now, we’re going to look inside the “buffer” folder and select “alt_outbuf”.
When you click on an item a preview will appear in the right hand window.
Click the OK button and your mouse will start dragging the chosen buffer around. Click anywhere on the workspace to place the buffer onto it. You then need to go back to the symbol tool button and browse down to primitives / other and select vcc. Place the VCC object onto your workspace and return to the symbol tool button, this time browsing to primitives / pin and select the output object. You can also access the pin selector easily by clicking the pin tool button in the toolbar.
Make sure you’ve placed an output pin into your workspace so that your screen should look like the image to the left. If you’ve placed your objects in a different order, you can move them around by simply dragging them around your page.
The next step is to link the pieces together. If you hover your mouse over the lines protruding from the output buffer, your mouse cursor will change slightly. Hold the mouse button down and move it towards the other item you’d like to connect to. A line will appear while your mouse is moving to show that you are creating a link. Link the VCC to the input (left side) of the buffer and link the output of the buffer to the pin.
You should now have a circuit that looks like this. If you double click the output pin, you can rename it to something more sensible. It’s a good idea to get into the habit of renaming inputs and outputs because your projects will grow over time and it’s easy to get confused.
Now would be a good time to save your project. The next thing you’ll want to do is compile your schematic. Click the “Start Compilation” button and let the software do it’s thing. I can take a minute or two sometimes. Once it’s completed, you’ll be shown a compilation report. Hopefully there aren’t any errors but if there are, they will be shown here.
Providing the compilation went smoothly, you can now configure your pin settings. If not, you’ll need to go back and see where you went wrong. It’s not always immediately obvious but once you get used to working with the software, you’ll find it easier to rectify mistakes.
Click on the “Pin Planner” button and the software will open another window. Altera seem to enjoy making things look complicated when in fact they really aren’t.
If you look at the lower part of the window, the excel looking part is the bit we’re interested in.
You’ll notice that underneath “Node Name” your pin is listed by it’s name and direction. This is why you’ll want to name your pins.
Double click the empty field underneath “Location” and a little drop down box will appear. This is where you decide which pin you’re going to connect your LED to. I’m choosing pin1 for now. Click anywhere in the window to finalize your choice. Now you can close the pin planner.
The next thing to do is re-compile. I got stuck for quite a while until I figured out that you have to compile both before and after selecting pins. Also re-compile after making any changes to the schematic.
You’ve now made your first logic circuit and are ready to program your CPLD chip. Now it’s time to connect your programmer to the PC and the CPLD board. We’ve got a Bus-Blaster compatible programmer but yours may be different.
Once you’ve connected your JTAG programmer and powered up your CPLD board, you need to press the “Programmer” button on the toolbar. Yet another complicated looking window will appear but as before, it’s pretty simple really.
The Quartus II software auto-detected my programmer so the only thing I had to do was click the little check box indicated by the badly drawn arrow. The check boxes are empty to start with but once you click the top box, the others will auto fill. The next thing to do is click “Start”. The progress bar fills and then after a few moments your design will be embedded into your CPLD chip.