Another Home-Brew - Z180

General "chat", not necessarily MTX related
Martin A
Posts: 453
Joined: 09 Nov 2013 21:03

Re: Another Home-Brew - Z180

Post by Martin A » 08 Feb 2020 23:47

Using PVC insulated wire is a LOT trickier than using the Kynar covered "stuff" designed for wire wrapping.

PVC tends to shrink back when a hot iron is placed on the wire, Kynar doesn't, that makes a massive difference when you've got a few hundred, (or thousand) points to wire.

Bill B
Posts: 237
Joined: 26 Jan 2014 16:31

Re: Another Home-Brew - Z180

Post by Bill B » 07 Mar 2020 22:14

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.

Martin A
Posts: 453
Joined: 09 Nov 2013 21:03

Re: Another Home-Brew - Z180

Post by Martin A » 08 Mar 2020 15:08

If you have a "spare" EPM7128, you could shove that into the CFX-II and test your USB blaster with that. And hopefully confirm that it is working.

Bill B
Posts: 237
Joined: 26 Jan 2014 16:31

Re: Another Home-Brew - Z180

Post by Bill B » 21 Mar 2020 18:00

Finally found the first issue with my USB Blaster clone. The ten wire data cable had been assembled with one of the connectors reversed :o

I did not have a spare connector, and these IDC connectors are not meant to be removable. However, with some careful levering I was eventually able to remove the reversed connector, and put it back again the correct way around, shortening the cable by a cm. Having done so the cable has been carefully checked for both continuity of each connection, and short circuits between adjacent pins, and tests OK.

However, I am still not having much luck :(

I am using the Tools / JTAG Chain Debugger option in Quartus:

Testing with a EPM7032S on a breadboard, with no power applied to the chip, I get
JTAG_3.png
JTAG_3.png (1.89 KiB) Viewed 583 times
which is not surprising. If I also apply 5v to the 7032 then I get no response to either the JTAG chain test or the IDCODE iteration test.

So next move was to try the same tests against my CFX-II. Result with no power applied was the "No device detected", as expected. However, applying 5v to the CFX-II and repeating the JTAG chain test gives variable results, one of which is shown below:
JTAG_1.png
JTAG_1.png (35.98 KiB) Viewed 583 times
However, on repeated tests I have seen one, two or three devices detected, either with Unknown ID, or random IDs.

Following Martin's experience I have tried replacing the USB cable to the USB Blaster, but that does not make any difference.

Possibilities:
  • My USB Blaster was faulty from the beginning.
  • It has been damaged connecting it while the cable was twisted.
  • There is something else that I am still missing.

Post Reply