Friday, June 26, 2020

Atmel ATF1504AS(L) CPLD Development Board - Part 6 - Alternate Programmer

As I mentioned before the blogger from hackup.net  has created his own programmer for the ATF1504AS CPLD so when I get the parts I'm going to document building the programmer and how to hook it up to and program my Dev Board.

Please visit the following original source sites first:

Building the Programmer

From reading the blog and the schematic I've sourced the following parts for the build:

 Part    URL NoReq Notes
 PCB Hackup Github
 1 You will need to generate your own gerber and nc drill files to get this manufactured from this file in KiCad : ATF2FT232HQ.kicad_pcb
FT232H AliExpress 1     
 ATF1504AS-10JU4-ND  Digikey U1 IC CPLD 64MC 10NS 44PLC
 ED90008-ND Digikey U1 CONN SOCKET PLCC 44POS TIN
 ED1543-ND Digikey J2 CONN HEADER VERT 10POS 2.54M
 700-MAX662AESA Mouser U2 Switching Voltage Regulators 12V
80-T491A475K16AT7280 Mouser C7, C8
 Tantalum Capacitors - Solid SMD 16V
 220nF     
 C5, C6
 220nF SMD 0805 Capacitors
 0.1uF  C1-4 0.1uF (100nF) SMD 0805 Capacitors

You will also need :
    Pin Headers  ( for J1 )
    Pin Header sockets  ( for J1 )
    Switches : I got these Sparkfun switches ( for JP1, JP2 )


Finally I have all of the parts and I've built my own programmer

 
Before you start, lets set JP1 to OFF and JP2 to 3.3V.
 

Setting up Windows 10 with the required software

You will need two pieces of software to run the programmer on Windows 10.
 
1) Zadig 2.5
 
Make sure you install the WinUSB driver first!

 
2) OpenOCD v0.10.0-14
 
        Unzip this into C:\OpenOCD
 

Trying it out

 

Put them in C:\OpenOCD\bin

Plug in your adapter

Run the command from Hackup.net
 
 



Sweet we are done!
 

 Lastly, can I program my Dev board with it!

. . . and the answer is yes, it is 100% working!!!
 
Thank you Hackup.net!
 
 


 






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