Home of the G3UKB Acorn-SDR project

Altera Devices

This page details the work being done to better support the programming of the Altera devices in the HPSDR system.


This is going to be a 3-prong approach.

  1. Document a manual way using the Altera tools of programming the devices from both Windows and Linux (Ubuntu) with all boards in-situ (no board shuffling).
  2. Develop a program to automate the process of updating firmware by a simple point and click process. Programming will utilise the Altera tools.
  3. Develop a stand alone programmer that does not require the Altera tools.

Prong 1

The first step is to use the tools as are, that is, both the developed USB-Blaster code and the Alter Quartus programmer to program boards in-situ.

General (os independent)

Jtag Chain

Up to now the programming has required pulling boards in and out of the Atlas bus and moving them around in order to program. This is actually not necessary because the Quartus programmer is quite capable of determining the jtag chain and directing its program loading to a specific device.

The jtag chain loops through  each board on the atlas bus and requires the last board in the chain to have the 'last jtag' jumper set. In order to program any board in the chain therefore the boards have to be in adjacent slots otherwise the chain will be broken.

The configuration I have been testing with is:

Setting up the configuration scripts

In order to program a board there has to be a .cdf file to feed to the programmer (quartus_pgm).

Below is a script that programs penny given the above configuration of boards.

/* Quartus II Version 9.0 Build 235 06/17/2009 Service Pack 2 SJ Full Version */
    P ActionCode(Cfg)
        Device PartName(EP2C8) Path("/home/bob/dev/projects/acorn-sdr/ozy/") File("Penelope_V1.1.jic") MfrSpec(OpMask(1) SEC_Device(EPCS4) Child_OpMask(1 1));
    P ActionCode(Ign)
        Device PartName(EP3C25) MfrSpec(OpMask(0));

The easiest way to generate this is to run up the Quartus GUI (this must be done in Windows unless you want to pay the subscription fee for Linux (see later for Linux 'free' use). You only have to do this once. Once the script files are generated you can use them with the command line tools.

  1. First load USB-Blaster code into Ozy. Follow the general instructions for doing this except you don't need to remove any boards, just leave them where they are.
  2. Start Quartus II GUI.
  3. Press the 'Hardware Setup' button (top left) and connect to USB-Blaster.
  4. Press the Auto-Detect button on the left and you should get two devices displayed. The first will be Penny and the second Mercury (or in whever order you have boards plugged in). Note that Ozy itself will not appear on the chain due to the way the hardware connects things up on the Ozy board. 
  5. Right click on either one and select 'Change File'. Select the .jic file you want to load into the device. The file will then be shown under the device.
  6. Check the 'program/configure' checkbox.
  7. At this point you could just hit 'Run' to program the device but the object is to get the config file so do a 'save-as' and save the generated .cdf file.
  8. Repeat this for each device you have so you end up with a .cdf file for each board.


  1. To program the board from the command line:
    quartus_pgm -c USB-Blaster <your path>/ (or \ if you are Windows)whatever.cdf
    Programming should commence and terminate correctly.

windows specific

There really isnt much to say. The Altera tools are free, install simply and work well. If you are on Windows you have easy life with Altera.

linux specific

In contrast there is quite a lot to say about Linux.

Firstly, I have by no means exhaustively tested anything but this is how things are to the best of my current knowledge.

The Altera Linux support is patchy and poorly documented. In principal you have to take out a subscription edition license (very expensive) and only RedHat and Susse is officially supported. Some versions have a 30 day trial period, but that seems to apply to very few of the Linux versions. Having said that, there are ways to make it work on pretty much any Linux distro and more importantly the command line tools seem not to require a license. This means that there is a route to Linux programming.

I have struggled on and off for at least a week trying to get things working. I have two machines, a quad-core running Ubuntu 8.04 and a laptop running Ubuntu 9.04. I have so far failed to get it to work on 8.04 (for reasons that I know not) but I have successfully programmed from 9.04. Your milage may vary and I would be pleased to know of any success on other versions or distros.

These are the steps you need to go through. These are taken from a number of sources all of which seemed to miss out something.Again there may be other things you need to do in some circumstances.

Get the install from Altera

  1. Get 7.2 for linux and the linux installer at https://www.altera.com/support/software/download/altera_design/quartus_sub/dnl-quartus_sub-v72.jsp
  2. Unless you want them you don't need MegaCore IP, Nios ll or ModelSim.
  3. Copy the installer anywhere you like and unarchive.
  4. Copy 7.2_quartus_linux.tar into the installer root directory.

The install requires tcsh not csh

  1. sudo apt-get remove csh tcsh
  2. sudo apt-get install tcsh

Run the install

  1. cd to the installer directory.
  2. sudo ./install_download. Accept all defaults and don't install MegaCore IP, Nios ll or ModelSim. unless you downloaded them.

Create a file required by jtagconf

  1. cd ~
  2. touch .jtag.conf

Create a script to mimic arch as this is an old RedHat command.

  1. sudo gedit /bin/arch
  2. Add the lines
    #! /bin/bash
    uname -m 
  3. sudo chmod 755 /bin/arch (to make executable)  

Copy the parts library

  1. sudo mkdir /etc/jtagd
  2. sudo cp /opt/altera7.2/quartus/linux/pgm_parts.txt /etc/jtagd/jtagd.pgm_parts

Testing and Running

  1. Load the USB-Blaster code into Ozy.
  2. cd to the /opt/altera7.2/quartus/bin (again you can set this stuff on your path)
  3. sudo ./jtagd (there is an init file you can use to run the service at startup, I will ad this later). This runs the jtag daemon.
  4. ./jtagconfig. This should give you the device list of your boards.
  5. Also try ./quartus_pgm -l (should report the blaster) and quartus_pgm -c USB-Blaster -a (again should report the boards).
  6. To program ./quartus_pgm -c USB-Blaster <your path>/whatever.cdf

prong 2

The second prong will automate all of the above. This is only thoughts at the moment but the plan is to do a stand-alone programmer which will run on Windows and Linux (this will be written in Python). It will have a graphical interface and give simple programming of all devices. This will probably be driven by a configuration file (possibly XML) that contains all necessary firmware release details. All the firmware files and the configuration file could be held on an FTP server. At some point I will integrate this into Acorn.

The sequence could be something like the following:

  1. Ask the user what boards/sequence they have. This part can be remembered so they only need to change it when they change boards.
  2. Ask them to power up the hardware.
  3. Load  some  preliminary firmware in Ozy and interrogate the remaining hardware to find the versions of firmware loaded.
  4. Load up the USB-Blaster firmware.
  5. From inside the app we now run quartus_pgm commands and intercept the responses.
    1. run quartus_pgm -l to make sure we have a usbblaster.
    2. run quartus_pgm -c (the result from (a)) -a to get the jtag chain.
    3. compare the chain to the given board sequence. We want to match the number of devices and the device types on the boards. Tell the user if there are discrepancies.
    4. Give the user a list of firmware releases available by board and highlight their current configuration, the latest releases and possibly recommend an update. Full compatibility details and descriptions of the firmware versions will be displayed.
    5. allow the user to choose what devices they want to program and the firmware version. Only allow compatible versions.
    6. generate the .cdf file from a template to match the jtag chain and the files the user wants to update.
    7. run the update, first getting the necessary files from an ftp server.

prong 3

The 3rd prong is where it gets difficult. At this point I don't even know if it's possible and I would need a deal of help to implement it. The game plan is something like create an embedded programmer in the FX2 which can perform jtag programming. This could be based on the Altera JRunner code which is freely available and some work was already in progress on that by Michael G3WOE. A bespoke piece of code will probably  be required for the FPGA to emulate the Serial Flash Loader that Quartus provides. A relatively simple piece of PC software would then be required to download the files and guide the programming. If this means nothing to you, don't worry, it means very little to me yet and would have meant nothing a couple of weeks ago.