Mixing AVRs, Xilinx CPLDs, and JTAG

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Mixing AVRs, Xilinx CPLDs, and JTAG

Postby bigmessowires » Tue Nov 29, 2011 1:13 am

I'd appreciate some advice on a design I'm making that uses an ATMEGA1284P microcontroller along with a Xilinx XC9572XL CPLD. What would be the easiest, cheapest way to program the two?

The default solution is to use a 2x3 ISP connector for the ATMEGA, and a 2x5 JTAG connector for the CPLD. I'd have to purchase a Xilinx JTAG programmer, because even though I already have an Altera JTAG USB Blaster clone, the Altera JTAG programmer apparently won't work with Xilinx parts.

A second option is to use a single 2x5 JTAG connector, connect the two chips in a JTAG chain, and use JTAG to program them both. But with what programmer? I don't want to have to purchase a Xilinx JTAG programmer and the Altera AVR JTAG ICE Programmer. Is there a generic JTAG programmer that would work with them both?

A third option is to use the ATMEGA to program the CPLD somehow, by connecting the CPLD's JTAG pins to GPIO pins on the ATMEGA. Then I'd only need a single 2x3 ISP connector for programming the ATMEGA, and could use the AVR ISP programmer I already have. But I don't relish trying to write some kind of JTAG player for the AVR, and a brief search to see if something like that already exists didn't turn up anything.

Anybody have a suggestion on the best way to go about this?
bigmessowires
 
Posts: 59
Joined: Sun Jun 05, 2011 6:34 pm
Location: San Francisco

Re: Mixing AVRs, Xilinx CPLDs, and JTAG

Postby bigmessowires » Wed Nov 30, 2011 12:54 pm

Looks like Xilinx has an app note explaining how to program a CPLD, FPGA, or PROM using a microcontroller. The app note includes sample C code. http://www.xilinx.com/support/documenta ... app058.pdf

http://www.ethernut.de/en/xsvfexec/ has a working example from an ATMEGA128 used to program an XC9536XL. This may be a reasonable solution.
bigmessowires
 
Posts: 59
Joined: Sun Jun 05, 2011 6:34 pm
Location: San Francisco

Re: Mixing AVRs, Xilinx CPLDs, and JTAG

Postby cstratton » Wed Nov 30, 2011 1:08 pm

A xilinx style jtag cable can be pretty inexpensive, and it's likely possible with pc-side software and a wiring adapter to use the altera cable for xilinx parts, but I'd vote for giving programming it from the avr a try.

Generally there are two options for how to do this, depending a bit on the capabilities of your embedded system (especially if it has something approximating a "disk") and it's data channels to the outside world.

For small micros, I've tended to go with building some sort of "jtag adapter" mode into the firmware. The PC runs a modified open-source jtag (or whatever) "player" program which sends low level commands over the serial/usb/etc channel to the micro which twiddles the actual wires. This could be something very primitive like a hex-encoded nibble indicating the state of the wires. However, doing it that way can be very slow, especially if it results in single-byte transfers on a usb-serial adapter. A faster approach may be to look at the structure of the player software and move the loop responsible for some unit of jtag data transfer into the embedded device, in order to run the pc-micro channel in larger packets. Or possibly have the player software queue up operations and hand them off in a batch. This tends to work fairly quickly for raw program operations, but slowly for verify ones where you have to stall on the double latency of the pc-micro communications channel every time you "read".

For larger systems, for example something running an embedded linux, you can often just port a bit-bang type player application to the embedded system, ftp the programming data file over, and run it there much as you would on a PC with a simple jtag dongle.
User avatar
cstratton
 
Posts: 246
Joined: Wed Sep 29, 2010 2:52 pm

Re: Mixing AVRs, Xilinx CPLDs, and JTAG

Postby Sowbug » Wed Feb 15, 2012 8:08 pm

Did you solve this? A couple weeks ago I wrote The JTAG Whisperer, which would work nicely with your 5V-tolerant XC9572XL. It's an XSVF player structured as an Arduino sketch, but I didn't use too many Arduinoisms so it could also be adapted for the 1284 if you wanted to reprogram the CPLD in-circuit and didn't want to build in the four JTAG header pins.

As far as cheap goes, if you already have an Arduino and four jumper wires, this way is free.
Mike Tsao
www.sowbug.com
Sowbug
 
Posts: 9
Joined: Thu Nov 24, 2011 10:26 pm


Return to Microcontrollers

Who is online

Users browsing this forum: No registered users and 3 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [105]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]