I have not had much free time to work on this recently, but I am making slow progress.
At least I now know that my EPM7032S chips are not JTAG locked
Altera developed the Jam Standard Test and Programming Language for defining the signals needed to program and test JTAG devices. The idea is that the language can be implemented on embedded devices to provide in-system modification, see the description
here.
The source for a Jam interpreter can be downloaded from
here. Although the download is nominally a Windows executable, it is actually a self-extracting zip file, and can be expanded on Linux using "unzip jp_25.exe", without having to run the file.
I edited the source to use RPi GPIO to read and write the JTAG signals, and used a 74HCT245 to raise the outputs to 5v and a resistor divider to drop TDO back to 3.3v.
A Jam file to read the ID code of a chip is available from
here. Running this file with my modified Jam player gives:
Code: Select all
pi@raspberrypi:~/JAM $ ./jam -gtck=17,tms=22,tdi=23,tdo=27 -f1000 -aread_idcode idcode.jam
Jam STAPL Player Version P01 (20170909)
Copyright (C) 1997-2004 Altera Corporation
******************************************************************************
* Altera Chain Interrogation Version 5.0 *
* Copyright (c) 1999-2007 Altera Corporation. All Rights Reserved. *
******************************************************************************
Chain Continuity Checker
Chain Continuity during IR is not stuck at zero or one
******************************************************************************
Chain Length -- Load IR of all ones then count DR length
Number of Devices is 1
******************************************************************************
IR Length Calculator
Instruction Register Length is 10
******************************************************************************
IDCODE Reader
---------- | ---- ------------------- ------------- - |
TDO -> TDI | Rev Device Mfgr 1 |
---------- | ---- ------------------- ------------- - |
Device #1 | 0000 0111 0000 0011 0010 0000 1101 110 1 |
---------- | ---- ------------------- ------------- - |
******************************************************************************
Device Identifier -- Search for device name from list of device IDCODE values
---------- | ------------------- ------------- |
TDO -> TDI | Device Mfgr |
---------- | ------------------- ------------- |
Device #1 | EPM7032S Altera |
---------- | ------------------- ------------- - |
******************************************************************************
Exit code = 0... Success
I repeated this with each of my EPM7032S so I know that they all have working JTAG.
As described in the documentation, Quartus can produce Jam files which it should be possible to program the chip. So I generated the Jam file for my design. A single Jam file can perform a number of different actions, one of which can be selected by the -a switch when running the Jam player. Once again, testing the ID code looks hopeful:
Code: Select all
pi@raspberrypi:~/JAM $ ./jam -gtck=17,tms=22,tdi=23,tdo=27 -f1000 -aCHECK_IDCODE Z180_EC_Mem_CPLD.jam
Jam STAPL Player Version P01 (20170909)
Copyright (C) 1997-2004 Altera Corporation
Device #1 IDCODE is 070320DD
DONE
Exit code = 0... Success
However, trying to use the Jam player to actually program one of the chips results in:
Code: Select all
pi@raspberrypi:~/JAM $ ./jam -gtck=17,tms=22,tdi=23,tdo=27 -f1000 -aERASE Z180_EC_Mem_CPLD.jam
Jam STAPL Player Version P01 (20170909)
Copyright (C) 1997-2004 Altera Corporation
Unrecognized device
Exit code = 6... Unrecognized device
pi@raspberrypi:~/JAM $ ./jam -gtck=17,tms=22,tdi=23,tdo=27 -f1000 -aPROGRAM Z180_EC_Mem_CPLD.jam
Jam STAPL Player Version P01 (20170909)
Copyright (C) 1997-2004 Altera Corporation
Unrecognized device
Exit code = 6... Unrecognized device
This is not the first time I have run across this problem. I also encountered it a few years back when attempting to use Jam to program an EPM7128S for my CFX-II.
The Jam files are simply text files, containing instructions in the Jam language, and it is possible to edit them and insert diagnostics. I have done so, and I know exactly where in the source the code is exiting. However the code is fairly cryptic, so although I know where the chip is being rejected, I don't understand why. It may be it is testing for a blank chip (although that would not make sense for the erase action).
It would be possible to just bypass the test and let the code continue. But if that part of the Jam code is faulty, I don't have any confidence that the actual programming code is correct, and I could end out just locking the chip.
So back to trying to work out why programming with my USB Blaster clone is not working

This is the first project I have tried to use this on.