Friday, June 26, 2020

Atmel ATF1504AS(L) CPLD Development Board - Part 5 - Attach Switches and LEDs to demonstrate the working code

Now you have programmed the board you will need a Switch and two LEDs to show it working.  So lets build that now.

We will also build a more complex set of daughter boards for further experimentation.

Simple wire version

Let's just use the headers on the board for a quick and dirty demo to show the code we have just uploaded to the Dev board actually works.

You will need:
    • 2 x resistors 1K Ohm ( for LED's )
    • 1 x resistor 10K Ohm ( pull down for Switch GND )
    • 1 x resistor 330 Ohm ( for Switch +5v )
    • 2 x LED
    • 1 x tactile switch
    • 6 x jumper wires
    • 1 x bread board

You'll notice that pin 17 is connected both the switch and ground via a 10K resistor (pull down). This is so the pin is not floating when +5V is not being passed to it.  If it's allowed to float you will get some really weird results.  It's worth pulling it out just to observe the issue.

When complete one LED will light up.
Pressing the button will light the other LED and turn off the other.
When the button released it will switch back.

    


Simple daughter board version

Now create a couple of daughter boards for more complex code experimentation.
 

Thursday, June 25, 2020

Atmel ATF1504AS(L) CPLD Development Board - Part 4 - Write an example program and Program the CPLD

For a basic demonstration we will write a small piece of code to demonstrate the CPLD Dev board is working.  This code will use a single switch to turn on and off some LEDs.


Create a Quartus project

Start up Quartus 13.1 on your computer and we will create a new project from scratch.

  • File => New Project Wizard

  • Enter the project details and Next>
 Working Directory
 C:\altera\projects\swtichled_cpld
 Project Name
 switchLed
 Top-level Entity
 switchLed



  • Click Yes


  • Click Next>

  • Enter the following Details and Click Finish
 Family     7000s
 Package PLCC
 Pin count
 44
 Available Devices
 EPM7064SLC44-5


  • Open the pin planner

  • Setup the following pins with "node name" and "location"


  • Create the top level Design file, Click OK, Click OK and then close the pin planner




  • Double click to open the switchLed Entity


  • Replace the file contents with this! and save it

 `timescale 1ns/1ps

module switchLed
(
    output led1, led2,
    input switch1
);

assign led1 = switch1;
assign led2 = !switch1;

endmodule


  • Compile the code by double clicking on Assembler

  • You should end up with two warnings, but it will be successful.

  • You should now have a .pof file in the output directory.
       


Create the Jed file using POF2JED

  • Startup POF2JED and enter these details and click "Run"
Input File
 C:\altera\projects\swtichled_cpld\output_files\switchLed.pof
 Device 1504AS
Output File
 C:\altera\projects\swtichled_cpld\output_files\switchLed.jed


Program the CPLD using ATMISP v7.3

  • Attach the ATDH1150USK-K programmer to the Dev board and your computer



  • Startup ATMISP v7.3 and Click on Edit => Add New Device and Click OK


  • Enter the following details and Click OK
 Device Name
 ATF1504AS
 JTAG Instruction
 Program/Verify
 JEDEC File
 C:\altera\projects\swtichled_cpld\output_files\switchLed.jed




  • Now click Run


  • It should finish with success, time to move on to the next step