PART4OpenOCD (native Linux, version 0.12.0)
I did have troubles with the "preferred" version in the Mint/Ubuntu repositories and also the executable images on the openocd website
https://openocd.org/ . Most probably because I have just soooo many dev tools on my dev PC...
So anyway I downloaded the full archive of the latest stable version and compiled and built it using the provided install tools.
I also fell into the usual "clone trap" : the USB Blaster I was given is supposed to be a V2 but it isn't. So I'll try to highlight the two processes for the two types of USB blaster ( V1 : ftdi interface or V2 : native USB ).
If installing from scratch, you'll need to ensure a few things for the USB communications to work (either version):
- ensure that you belong to the 'plugdev' group [ sudo usermod -a -G plugdev <username> ] Type just 'groups' to see what groups you belong to.
- be sure that the udev rules file lists the correct access permissions for the USB Blaster ( /etc/udev/rules.d/51-usbblaster.rules )
it should look like :
Code:
# Intel FPGA Download Cable
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6001", MODE="0666"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6002", MODE="0666"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6003", MODE="0666"
# Intel FPGA Download Cable II
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6010", MODE="0666"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6810", MODE="0666"
(and no, the 666 isn't some mystical incantation - just R+W permissions !)
- locate where your openocd system is installed (generally /usr/share/... or /usr/local/share/...) 'cos you'll need the paths to some of the files.
Blaster V1 process :
... it *should* work out of the box ... Try typing (cut/paste
) this :
Code:
openocd -f <your path to openocd>/scripts/interface/altera-usb-blaster.cfg -c "adapter speed 400" -c "jtag newtap ATF1504AS tap -irlen 3 -expected-id 0x0150403f" -c init -c "sleep 200" -c shutdown
[ Note the "expected-id" parameter. If things don't seem to work correctly, check that the id really *does* match the ID of your chip ]
You should see a transcript like :
Code:
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
adapter speed: 400 kHz
Info : usb blaster interface using libftdi
Error: unable to get latency timer
Info : This adapter doesn't support configurable speed
Info : JTAG tap: ATF1504AS.tap tap/device found: 0x0150403f (mfg: 0x01f (Atmel), part: 0x1504, ver: 0x0) << Yipeee !!
Warn : gdb services need one or more targets defined
shutdown command invoked
If you see this, especially the "tap/device found" part, then you're well underway ! Now's the time to check that the device ID is correct.
What all the above gibberish means :
any "-f" followed by <something> just means run the script contained in the file <something>.
In this case "altera-usb-blaster.cfg" is the configuration script for our ftdi-based USB Blaster.
any "-c" declarations are simply individual openocd commands :
-c "adapter speed" : set the communication speed (in kHz) of the session
(note that some adapters dont support variable speed : openocd will report a message but will function with the correct default speed - as above)
-c "jtag newtap ATF1504AS tap -irlen 3 -expected-id 0x0150403f" : add a new TAP (Test Access Port) to the JTAG chain.
Here we give the TAP a name (ATF1504AS); the type of device (tap, in this case, is used to declare CPLDs that have only 1 access port); -irlen is the Instruction Register Size (in bits) of the device; -expected-id is the JEDEC ID Code of the device.
-c "init" : initialize the device
-c "sleep 200" : I'll let you work-out what that does
-c shutown : do anything special for shutting-down the device (probably not required for our setup)
NOTE : all of these, and many more, commands are explained in the user guide (locally or online at
https://openocd.org/doc-release/pdf/openocd.pdf )
NOTE : if your device refuses to identify itself, it may be that it is protected : see "Unprotecting" above.
Here is a sample programming session :
1) Erasing the device (using the Erase.svf file created in ATMISP, above) : (note that your path to openocd may be different to mine)
Code:
openocd -f /usr/local/share/openocd/scripts/interface/altera-usb-blaster.cfg -c "adapter speed 400" -c "jtag newtap ATF1504AS tap -irlen 3 -expected-id 0x0150403f" -c init -c "svf Erase.svf" -c "sleep 200" -c shutdown
From this point onwards, you shouldn' need the Vpp voltage anymore. Remember to follow the shutdown sequence, remove the 12v and away you go!
2) Programming the device (here I'm using the code for Daryl "8-bit" 's 6502<->SPI interface) :
Code:
openocd -f /usr/local/share/openocd/scripts/interface/altera-usb-blaster.cfg -c "adapter speed 400" -c "jtag newtap ATF1504AS tap -irlen 3 -expected-id 0x0150403f" -c init -c "svf 6502_SPI.svf" -c "sleep 200" -c shutdown
Blaster V2 process :
I haven't dug any deeper to find-out if there is an alternative, but using this version of the USB Blaster requires at least one file from the Quartus Lite package. As it turns-out I had already tried installing Quartus (it actually installs native Linux) to see if it would program the ATF150x chips (spoiler : it doesn't). There is a special openocd configuration file ( <path to openocd>/scripts/interface/altera-usb-blaster2.cfg ) that needs to be modified before trying to use the system. You'll need to be familiar with a text editor that can be run with "sudo" privileges (e.g. nano), to modify the file so it looks like :
Code:
#
# Altera USB-Blaster II
#
adapter driver usb_blaster
usb_blaster vid_pid 0x09fb 0x6010 0x09fb 0x6810
usb_blaster lowlevel_driver ublast2
usb_blaster firmware /home/glenn/intelFPGA_lite/22.1std/quartus/linux64/blaster_6810.hex [color=#BF0000]<<-- this is important[/color].
( The higher privileges are required because the file resides in a directory where you normally only have read access. )
It is very possible that the blaster_6810.hex file is all that is required, and that it can be "procured" without treading on any copyright toes, but as I don't currently need this setup I'm not going to investigate further.
Once the config file is correctly modified, the rest is exactly the same, except you replace .../interface/altera-usb-blaster.cfg with .../interface/altera-usb-blaster2.cfg. You can follow the instructions for Blaster V1, above.