InfoRant: FPGAs, CPLDs, JTAG and the mystified novice. - Page 1
Forum section: electronics / general

author: .o:0|O|0:o.
author_rank: Regular Contributor
timestamp: November 03, 2010, 03:42:05 pm
content: I haven't had much luck, so I am writing a summary of my findings on FPGA/CPLD and related technologies. It has been a frustrating search for a well defined economical, versatile and minimalist method, which so far does not seem to exist for these devices (in the way that it exists for MCUs).In searching and studying all manner of things over the last few days, it has become apparent that in order to program an FPGA/CPLD as a beginner, the only way forward is to buy some form of educational development board with some form of cable, like a JTAG cable.Apparently, there is no way to buy a fresh chip, stick it in my own circuit - with whatever peripherals are required - and to program it using a USB port through either a cable OR a programmer and not a combination of both. Where there are a few neat solutions for the beginner, they require a PCI socket or a parallel port or a serial port. I guess I should have waited to upgrade my 90's PC a little while longer.There are converters that you can buy, but then that is still a chain of 2 or 3 pieces of gear between a laptop and a chip! I find that incredible! To add to the situation is that when Xilinx and Altera phase out a family of chips the respective development boards become obsolete too. Furthermore, the chances of getting support for anything other than a trivial matter in a Xilinx or Altera forum are close to zero:Is it the Vista or Win_7 that is not supported?Is it the development environment that hasn't been set up correctly?Is it the right JTAG cable?Is it the development board?Unless you figure out the problem for yourself you will probably never know or will be stuck for days chatting with other forum members about how they got around the issue in some unorthodox way, while all agreeing that the manufacturer "should" have done this, that and the other ...but didn't.you need a parallel port or a serial port (big in the 80's/ 90's, like Rick Astley), because an adaptation to USB is ridiculously expensive. Why?!In case someone is completely new to FPGAs and CPLDs, like I was, I have included some information that is worth reading. Don't buy a book at this stage, its a pointless waste of energy and money. Go through the following links for the introduction, then go through a few datasheets, and if you have gotten to the stage of buying the hardware, perhaps maybe get a book on how to code efficiently in Verilog...Key players: Xilinx (especially FPGAs), Altera (especially CPLDs). Lattice, Actel, QuickLogic have a much smaller share of the market.CPLDs or FPGAs? Different architectures (brief discussionhttp://www.xilinx.com/support/answers/7598.htm). Prices: CPLDs range from £2 upwards, while FPGAs range from £7 upwards. Xilinx also make CPLDs (just as cheap), they are market leaders for FPGAs, so they are the number one choice.This is a complete introductory course in slide form from a leading US University. It is not hard if you have some knowledge of digital; if you do not, it tells you what you need to know (and most is readily available in another of their courses or through Google).http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-111-introductory-digital-systems-laboratory-spring-2006/lecture-notes/MIT have a preference for Xilinx ISE and Verilog in that course. The Free software used in that course can be downloaded here...http://www.xilinx.com/support/download/index.htmhttp://www.xilinx.com/tools/webpack.htmThe difference between Verilog and VHDL is sometimes explained as the difference between C and ASM for MCUs/CPUs. Verilog programs tend to be shorter than VHDL and Verilog tends to be the more popular of the two (so potentially more examples of code and chance of support when the going gets tough).http://www.simpledigitalcomputer.com/PLDGettingStarted.aspxNow if you go down the Xilinx route and decide to buy some hardware to experiment with, you will probably end up programming CPLDs because FPGAs are expensive and you will be advised to buy a Coolrunner II board, which seems to be one of the popular ones:http://www.xilinx.com/products/coolrunner2/index.htm(For Altera chips, you will need completely different software and Altera hardware)If you want to In System Program (ISP) your device (i.e. do without the playing around on development board and just get on with your own design), then you will probably come across the term JTAG (JTAG is a standard or protocol that allows testing, debugging and programming by means of a JTAG cable). Now here is where you have a region of uncertainty: JTAG can be used to program your chip while it is in your design, but it is not sufficient. You still require some form of hardware from Xilinx (or other relevant chip manufacturer) to interface between your PC and the JTAG cable. There are a whole host of uncertain options: OpenSource boards and OpenSource cables; JTAG cables with different numbers of pins (the great thing about standards is there are so many to choose from!); JTAG with parallel port connector, serial port connector, 6FT cable ones or the manufacturers own expensive USB variation (for which you can't tell whether it requires a development board or not!).So if this not-quite-specified JTAG cable business hasn't put you off the idea and you are determined to get to the bottom of it all as I was then here is the most informative information I have found on the subject so far.http://www.ee.ic.ac.uk/pcheung/teaching/ee3_DSD/ti_jtag_seminar.pdf(also, download the DOS simulation to visualise JTAG at work!)http://www.corelis.com/education/JTAG_Tutorial.htmhttp://www.fpga4fun.com/JTAG.html(this site is worth exploring in detail)Final verdict on FPGAs/CPLDs:If you just want to learn on the development boards, maybe connect them up to a breadboard and scroll some text on an LCD, and it is not a requirement for you to program and debug a chip within your own circuit, then there are cheap educational kits for under £50. If you want to do serious design as a business, then prepare to buy expensive equipment (thousands of pounds). If you don't want to be restricted by the educational format of the economical development board but want something in the middle to experiment with ISP and your own circuits, the only way seems to be by using Linux and having a computer with a parallel port (or knowing someone who has done it before).Well, at least I understand how JTAG Boundary Scan works and some Verilog modules now....o:0|O|0:o.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: November 03, 2010, 03:53:55 pm
content: QuoteUtter nonsense. What 'Expensive equipment" are you talking about?A devboard is a good start to any FPGA project as all the power, clock and programming stuff is done to get you up & running quickly. Mst have plenty of headers and/or proto areas to build your own hardware around.When you put an FPGA on a new board the ONLY thing you need to pay for is a JTAG interface - £50-150 depending on brand.FPGA pricing is a funny one in that when you talk to a distributor you find that they can be had for half to a third of what Digikey, Mouser etc. list them for viia the murky world of "Supported Pricing",and I'm talking tray qtys, not thousands.The cheapest FPGA from Lattice is a little under £3 in 100x BTW.If you really don't want to buy a JTAG interface you _can_ stick a FPGA and SPI flash in aboard, program the flash an be up and running.

author: Zad
author_rank: Super Contributor
timestamp: November 03, 2010, 07:03:34 pm
content: You can bitbang JTAG over serial port too, using an external cheapo USB-to-Serial lead. I have an old Compaq SFF PC that runs Win2K for burning micros, flash, FPGAs etc, but it is getting less and less use (thank goodness).

author: EEVblog
author_rank: Unknown
timestamp: November 03, 2010, 08:38:47 pm
content: All the major players have direct USB JTAG programmers, but they can be expensive.Cheaper third party solutions exist though.All the manufacturers have cheap Dev boards that likely do what you want.Dave.

author: jahonen
author_rank: Super Contributor
timestamp: November 03, 2010, 09:01:53 pm
content: FPGAs are relatively simple things to get up and running. Here is a minimal FPGA design (Altera EP2C8T144 with EPCS4 config memory) with just a configuration memory and power, plus some pinheaders for IO. The most difficult part is the PCB. Physical packages tend to be somewhat hefty, at least if you make PCBs by yourself.I recently bought a USB-blaster clone fromEbay, I believe it is still available. Works ok with Quartus II. It supports both JTAG (volatile configuration, signaltap debug) and Active Serial (non-volatile configuration).Regards,Janne

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: November 03, 2010, 11:44:33 pm
content: There are also some manufacturer devboards (e.g. Xilinx SPartan-3) that include the same hardware as the manufacturer's seperate USB-JTAG interface on the board, and at a pinch you can connect an external board to the JTAG headers.In earlier versions they omitted it from the schematics and even chiildishly blanked it out on the PCB layouts, but on more recent schematics it is shown, and I believe it has been confirmed that the Xilinx S/w will automaticallly program the fiirmware into a blank chip if you want to DIY it...or justleave it to the Chinese

author: slburris
author_rank: Frequent Contributor
timestamp: November 04, 2010, 01:27:48 am
content: Using FPGAs isn't expensive these days at all. You can getthe Xilinx XC3S50A-4VQG100C from Digikey qty 1 for $5.52.They have more than 3000 chips in stock:http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=122-1592-NDYou can pick up a USB JTAG cable from Digilent for $40:http://digilentinc.com/Products/Detail.cfm?NavPath=2,395,707&Prod=JTAG-USB-FSPut the $6 xilinx chip and an SPI flash on your board and away you go!If you don't want to make your own stuff, I really like Digilent. They have a huge rangeof boards, and they aren't particularly expensive. The least expensive FPGA boardis $79 ($49 if you are a student), and you can get a CPLD board for $17.95You can get cheaper boards and cables from Ebay, with various degrees of compatibility,if you want to go that route.Scott

author: slburris
author_rank: Frequent Contributor
timestamp: November 04, 2010, 01:36:09 am
content: Forgot to mention that at <$10 pricing, I'm a huge fan of building thingsthat are a micro + FPGA plopped down on a PCB, then just defining allthe stuff the micro can't do in VHDL. I've even done a few designs withjust the FPGA and an embedded PicoBlaze processor (free from Xilinx).I've done both VHDL and Verilog and I personally find VHDL easierto wrap my brain around. If you are looking for a book, make sure it'sa book about VHDL or Verilog forsynthesis. Otherwise you'llget a book that talks about the language but doesn't explain how thingsend up as real gates.Scott

author: .o:0|O|0:o.
author_rank: Regular Contributor
timestamp: November 04, 2010, 02:58:39 pm
content: Thanks for all your replies! I was really close to giving up on the FPGA/CPLDs until I read these posts. I feel a bit bad about having to get a clone, but the closest genuine programmer I could find was this:http://www.xilinx.com/products/devkits/HW-USB-II-G.htm(and typically, a few hundred dollars ends up being a few hundred pounds... for a little more you can buy a decent DSO)..o:0|O|0:o.

author: armandas
author_rank: Frequent Contributor
timestamp: November 04, 2010, 03:25:54 pm
content: Quote from: .o:0|O|0:o. on November 04, 2010, 02:58:39 pmIf you're lucky, you can get one on ebay. In fact,this onewas sold today for £40. They don't appear very often though - this one is the second I have seen.Anyway, it would be nice to see a review one of the clones, if anyone has got one.

author: David
author_rank: Frequent Contributor
timestamp: November 04, 2010, 06:32:19 pm
content: I have designed and developed my own USB JTAG programmer for Altera FPGAs/CPLDs. I am currently working on an updated/improved version and I am hoping to make these available for around the £30 mark... I will post more details soon if anyone is interested.Dave

author: .o:0|O|0:o.
author_rank: Regular Contributor
timestamp: November 05, 2010, 05:29:36 am
content: I have done it the cheap Chinese way and ordered one of thesehttp://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=220692393799I will be pretty happy if it actually works.o:0|O|0:o.

author: Neilm
author_rank: Super Contributor
timestamp: November 05, 2010, 06:40:14 pm
content: Quote from: armandas on November 04, 2010, 03:25:54 pmI can tell you that is what I use at work. As for a review - I had the Xilinx free software loaded on the machine. (version 10). As I installied it over a year or so ago I don't remember having any real issues. I seem to recall there were two USB drivers to install - one for the USB and one for the programmer. I do seen to recall that I plugged it in, connected it up and it worked.The LED by the connector gives the status of the device. It certainly is green when it is connected and ready to programme, orange when connected to a PC but not powered by the target. I seem to recall it also goes red but I have not seen that.Using the Xilinx software I downloaded from the website it would scan the JTAG chain, it correctly identified the components on that chain and prompted for a file to load in each. I was using a Xilinx prom and FPGA as they noted that the chips would still be in production for 5 years - something necessary to know when you are replacing a product that has been in production for 15 years.As for ease of use of the devices - Xilinx datasheets are very comprehensive, possibly too much information. It is possible to miss what you are after but they do seem quite organised. They do inter-referance themselves so you have to pay attention. I got the silicon working first time following the notes and the programmes working quite quickly by the simulation packages. As there was nothing time critical I could avoid most of the timing pitfalls. It worked so well that when we finally got the various parts of the project together the 2 week main board and micro-controller integration time was reduced to about 1 hour. Most people couldn't believe it performed as the simulation (and the emulator I provided the guys writing the micro code) said it would.Neil

author: .o:0|O|0:o.
author_rank: Regular Contributor
timestamp: November 17, 2010, 04:03:49 am
content: Blaster + FPGA CycloneII board............Much better than I had expected. Now all I have to do is download QuartusII and figure out how to use the thing! Perhaps I will check the Cyclone for shorts under magnification first, and I am tempted to see what is inside the programmer.Feels like its Christmas already!.o:0|O|0:o.

author: .o:0|O|0:o.
author_rank: Regular Contributor
timestamp: November 18, 2010, 07:15:30 pm
content: I have downloaded Quartus II (the free web edition). The executable alone is huge (2.7 GB) compared to any other electronics software I have. Does it really need to be so large? The installation itself exceeds 5.2 GB !!!Anyway, it is a lot more sophisticated than MPLAB, MAXPLUS II, MatLab, PSpice or any other software I have used. It contains some nice Flash tutorials, which I have almost gone through...So far I haven't connected the programmer or FPGA board as the soldering on the FPGA pins looks a bit dodgy and I don't want to damage something. It is hard to tell whether there is an adhesive pad beneath the chip showing through the pins or whether there are shorts. Apart from the chip, the rest of the board looks very neat and tidy; the PCB is routed and perfectly smooth on all sides. How do they solder the components to both sides of the board, by the way? Is this a two stage process (one side, then the other), or is smarter than that? Also, all of the diodes appear to be tiny LEDs; if so, they are the tiniest LEDs I have ever seen and I want to buy some !The device in the photo is a EP2C5T144C8N, if anyone is interested. I think the 2C might stand for CycloneII, the 144 is the pin count, but the rest I don't know. Maybe it will become clearer.The datasheet indicates that the FPGA runs at 1.2 V, however, the board requires a 5V input, which is regulated down to 3.3 V by U5 (AMS 1117CD 3.3 0638). Maybe the 1.2 V refers to the core and the 3.3 V is for I/O etc. (?)I am tempted to do some continuity testing between neighbouring pins. Is there a risk that this could damage the device?.o:0|O|0:o.

author: Neilm
author_rank: Super Contributor
timestamp: November 18, 2010, 09:16:30 pm
content: Quote from: .o:0|O|0:o. on November 18, 2010, 07:15:30 pmAccording to the datasheetEP2C = Cyclone 25 = device typeT = Thin film Quad pack144 = pin countC = Operating temperature8 = Speed gradeN = Lead free device.Before you probe anything make a note of the voltage of your continuity tester. It is usually about 4V but sometimes it can be as high as 20V. Obviously, putting that much across a chip will damage it. If you are not sure then put a resistor in series with the probe to limit the current - that will reduce the probablilty of damage.Generally, the board will have a reasonably large input voltage and have a converter to reduce it to the votlages required by the chip, in this case 1.2V and VCCout (could be 1.5V to 3.3V). There are dedicated SMPS chips that are set to generate the voltages required with minimal external components.Neil

author: .o:0|O|0:o.
author_rank: Regular Contributor
timestamp: November 18, 2010, 11:29:21 pm
content: Thanks Nielm.Ok, the datasheet that I went through is 162 pages short (the second link), and there is a description at the very end (page 162), but it is a partial answer. Farnell's summary provides some clues too:http://uk.farnell.com/jsp/displayProduct.jsp?sku=1453497&CMP=KNC-GUK-FUK-GEN-SKU-G12&s_kwcid=TC|13123|ep2c5t144c8n||S|p|6820375269http://www.farnell.com/datasheets/5074.pdfMore information that I found ..."C" stands for "commercial" temperature range (0-85 degrees centigrade).Not sure I understand what "Speed Grade 8" means yet (does it mean minimum propagation time of 0.8 ns or 8 ns?). What does "Device Type 5" mean? Farnell's summary has "5K" in the title, but 4K Memory Blocks according to the datasheet (there is no mention anywhere in the datasheet of 5K). Might "Device Type 5" have to do with voltage (wild guess)? What does the "EP" actually denote? Electrically Programmable?Would trying to light up several known LEDs in series (till they don't light up anymore) be a good way of testing the voltage from the multimeter? Or would I have to measure it using another meter (I only have one at the moment). Also, would measuring on resistance/ohms be any safer for the device?Thanks again. It looks like it is going to be a very steep learning curve!.o:0|O|0:o.P.S. Altera USB Blaster PCB:

author: Neilm
author_rank: Super Contributor
timestamp: November 19, 2010, 06:32:22 pm
content: I'm not sure that the speed grade number relates to anything except the propogation delay in the chip. I know that the lower the number is the faster the chip works.The device type number relates to the internal memory capacity (see table 2-5) in that datasheet.Unless I knew about the meter I was using (or didn't mind having to replace the chip) I would put a known resistor in the lead to reduce the current and measure it using the ohms range.Neil

author: .o:0|O|0:o.
author_rank: Regular Contributor
timestamp: November 19, 2010, 09:46:41 pm
content: The Speed Grade in Altera devices refers to the propagation delay through a macrocell (generally called logic cells). The delay is measured in nanoseconds. Therefore, in the aforementioned chip it takes 8 ns for a signal to traverse a macrocell.http://www.altera.com/products/devices/dev-format.html#speedThe maximum frequency of this particular chip is around 150 MHz, however, it is externally configured to run at precisely 50 MHz (see XTAL in photo). Presumably, the speed grade is due to the quality of the silicon, which is what allows it to be potentially run at 150 MHz.The propagation delay is given for FPGAs, while processors and microcontrollers tend to show the maximum frequency on their packages. This is because the highly configurable nature of FPGAs makes the propagation delay a far more useful time reference than frequency does.A 40 MHz PIC MCU ("40" is usually printed somewhere on the device) corresponds directly to how many operations it can perform per unit of time, etc. The 40 MHz is divided by 4 to give an internal clock of 10 MHz and then depending on the operation, 1, 2 or 4 clock cycles might be required.In the case of an FPGA, the device might only use a small fraction of its logic cells or nearly all of them, which means that the frequency of the device per se does not yield the same degree of information as for the MCU. Furthermore, probably the main reason from what I gather, the propagation delay is essential for ensuring that signals reach gates on the correct clock edges (this is mentioned somewhere in those MIT lecture notes)..o:0|O|0:o.