1
\$\begingroup\$

There is a device called a JTAG programmer. This device is typically used to programm MCUs or FPGAs.

My question is do you actually need this device to program a MCU or FPGA with JTAG? Are simple wires/jumper cables not enough for the JTAG programming?

I mean to program a evaluation board you don't need this kind of device. Most of the time you can use a micro usb cable to program it.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ please post a link to one of the evaluation boards that you talked about \$\endgroup\$
    – jsotola
    Feb 1 at 17:06
  • \$\begingroup\$ Typically if you can program it over USB, it was already programmed via JTAG or some other method with a bootloader that provides those services. \$\endgroup\$
    – Ron Beyer
    Feb 1 at 17:07
  • \$\begingroup\$ @RonBeyer True for MCUs, less so for FPGAs. \$\endgroup\$ Feb 1 at 17:16
  • 1
    \$\begingroup\$ JTAG is really good for in-circuit debugging. There are sometimes/often alternatives for programming, it depends on the device. \$\endgroup\$
    – Frog
    Feb 1 at 18:44
  • \$\begingroup\$ Re, "simple wires..." Simple wires connecting what to what else? \$\endgroup\$ Feb 1 at 20:50
2
\$\begingroup\$

JTAG is a protocol, think TCP/IP, on which we can have web browsers, send email, tweet, etc...JTAG has a few primary use cases, in chip production you can use it to test the chip. In board level products you can use it to boundry scan basically light up a pin on one part and knowing the schematic see that the other parts that are supposed to be connected see the voltage. Low speed, grossly broken kind of a thing. And there there are use cases where you are talking to some peripheral for lack of a better term, and one primary use case there is an on chip debugger (OCD) which is extremely specific to the chip or processor core. Folks like ARM support jtag based debuggers into their products, but their mcu products are now primarily cortex-ms which support SWD instead of JTAG (well SWD is the main use case) which is a different protocol/interface.

JTAG is historically not used for programming or debugging MCUs, it takes too many pins for starters, 4 or 5 if you want reset or more. MCU vendors use other protocols some of which are home made and not standard. In most cases though all of these details are in the vendors documentation. And some may have multiple choices there may be a bootloader that you invoke with a strap pin and use uart, or spi or i2c protocols. Some may support i2c or spi in logic (not using a bootloader) some may have jtag or other similar. And a number of board level hobby products have a third party bootloader installed that has nothing to do with the chip vendor.

JTAG is just a very simple few wire serial protocol that can be used to daisy chain to many taps on the line. Used for chip test, board test, programming CPLDs/FPGAs, and sometimes talking to OCDs. If you look at the very simple state machine you see there are four areas where you can specify address or data, you can put whatever you want behind that (well there are some rules).


A number of eval boards, not all, will contain an FTDI device FT2232 or equivalent with mpsse support which makes it easy to support many protocols of which SWD or JTAG or others are not uncommon. Other boards you buy a debugger device which sometimes is simply an FTDI device or is sometimes an mcu that has been programmed to do the job. Look at most ST NUCLEO boards for example there is the target mcu and the debugger mcu (stlink).

\$\endgroup\$
1
\$\begingroup\$

It is, with effort, possible to program a system via JTAG using the interface by itself. In a high-volume manufacture the board test system would have JTAG support for not only board test, but for downloading firmware too.

As a practical matter, for developers to use JTAG for programming and debugging, the target JTAG port needs to be interfaced to a computer. Early JTAG adapters actually used the PC parallel port to bit-bang the JTAG signals. These setups were slow and somewhat finicky to install, but they worked. That's probably closest to the spirit of what you mean by "simple wires/jumper cables".

We have moved on to an era where USB has replaced the parallel port. So, too did JTAG adapters, which also have largely adopted the USB port. There’s a number of solutions out there for more efficient JTAG-to-host bridging. Many of these using the same chip, the FT2232, which includes hardware to do the JTAG bit-banging. Some systems even design this chip right into the board (e.g., Xilinx Virtex and Artix boards), simplifying the connection to the host even further.

For MCU program and debug, there were methods before JTAG, notably the serial port, which presupposes running code already present in the platform. This method lives on, often being performed over an ssh or telnet connection via Ethernet.

\$\endgroup\$
1
\$\begingroup\$

There is a device called a JTAG programmer. This device is typically used to programm MCUs or FPGAs.

JTAG is one of many standards used to program parts. IEEE STD 1532 is built on top of JTAG (IEEE STD 1149.1) specifically for the purpose of programming chips. IEEE STD 1532 has existed at least since the year 2000. Both Xilinx and Actel/Microchip use the 1532 commands to program their parts.

My question is do you actually need this device to program a MCU or FPGA with JTAG?

For micro-controllers, its a mix. Some use JTAG, some dont.

  • ARM MCUs typically use SWD (Serial Wire Deubg). Some ARM MCUs (like those made by Atmel) support JTAG, but usually just for boundary scan, not programming.
  • Some of the Atmel AVR MCUs like the XMega, program via JTAG.
  • The Atmel AT32 MCUs program via JTAG or a one wire serial protocol on their reset line called A-Wire debug.
  • Other low end AVR MCUs program via SPI.
  • Microchip PIC MCUs program using their own two wire interface (one clock line, one data line).
  • For any MCU which has the ability to modify its own flash memory, you can usually make a boot loader program that can load new firmware without a programmer. But boot loaders typically don't have the same debug features that you get from JTAG. Its very hard to design firmware without proper debug capability.

The majority of FPGAs support directly programming the part through JTAG. Additionally Xilinx FPGAs support debug via JTAG using a chip-scope core. This is extremely useful for debugging FPGA logic.

Actel/Microchip FPGAs boot directly from internal flash. Those parts must be programmed via JTAG in accordance with IEEE STD 1532.

Xilinx FPGAs and other SRAM based FPGAs that boot from an external PROM can be directly programmed either through JTAG. They also boot from an image in the external PROM, which means that (instead of directly programming the FPGA) you can program the PROM and then reboot the part to load a new image.

  • Use a PROM programmer to directly program the external PROM before its mounted on the board. The FPGA can then boot from the external PROM. This is mostly suitable for production cases.
  • Put a header on the PWB that allows directly programming the external PROM. The FPGA can then boot from the PROM.
  • Put code in the FPGA that can reprogram the PROM via some other communications channel such as CAN, RS485, Ethernet, etc. The FPGA can then boot from the PROM. Of course you need be able to initially get an image in to the FPGA or PROM some other way.
  • Configure the FPGA to boot in slave slave serial mode and use another part (CPLD, MCU, or FPGA) to load the bit-stream.

Are simple wires/jumper cables not enough for the JTAG programming?

So an FPGA typically has hundreds of thousands to even millions of configuration bits that need to be set to program the part. JTAG doesn't have a minimum clock rate, so in theory you could load the image a bit at a time using some toggle switches, but it would take you years to do it.

I mean to program a evaluation board you don't need this kind of device. Most of the time you can use a micro usb cable to program it.

Eval boards usually program via USB. Typically this is done using using a chip that converts between USB and JTAG. The most popular seems to be those made by FTDI inc.

JTAG programmers sold by manufacturers like Xilinx or Microchip are typically very expensive (several hundred dollars). There are third party programmers made by companies like Diligent that are much cheaper (like $60).

\$\endgroup\$
0
\$\begingroup\$

That is because, most of the time, the eval board USB port is the connector for an integrated on-board JTAG programming interface.

JTAG interface provides not only a way of fast programming, but debugging the program running on the MCU.

\$\endgroup\$
2
  • \$\begingroup\$ A USB port is not a programmer. It would be more accurate to say that many eval boards have an on-board device (e.g., a whole other microcontroller) that has a USB interface, and that can function both as a programmer, and also as a USB <=> serial port adapter. \$\endgroup\$ Feb 1 at 20:57
  • \$\begingroup\$ Not all MCUs have a JTAG interface for programming - most are custom interfaces. \$\endgroup\$
    – le_top
    Feb 1 at 22:37
0
\$\begingroup\$

JTAG is originally an industry standard to make PCB testing easier.

In its initial version it requires 4 or 5 wires (excluding ground), but there is a more recent version that only requires 2 wires (excluding ground).

When JTAG is available, it is generally at least used to test the chip during its production process. The manufacturer will have specific (secret) sequences to enter specific test modes and may disable access to these modes by programming internal EEPROM registers or otherwise.

In case you have a JTAG programmer to program the MCU's memory, then this means that the manufacturer provided a means to use the JTAG interface for programming.

The fact that you can program the MCU using an USB port does not mean that this USB port is using the JTAG interface. There are several Arduino compatible platforms that you can program using the USB because the manufacturer preloads a bootloader in the MCU.

Some MCUs natively propose multiple methods to program them. A low cost STM32 device I recently used has a built-in serial bootloader, but also has a dedicated programming and debug interface. Other STM32 devices may propose a built in USB bootloader compatible with the "USB Device Firmware Upgrade" protocol (techical presentation)

Most devices I have seen though use a serial link over USB using some USB to serial bridge (CH340G, CP2102, PL2103 chips).

Sometimes the USB port is presented as a Mass Storage Device to the PC and you can just drop your microcontroller program on the MCU to program it (this generally requires a pre-loaded "Bootloader").

I am not aware about the current state of the art for FPGA programming, but 20 years ago they already had at least two interfaces for programming them, and they could also read from an external serial EEPROM.

The advantage of JTAG is that JTAG devices can be chained and that the same interface has multiple uses (device programming, device debugging and PCB testing). JTAG standards make automation possible, but making a custom implementation from scratch is not that easy.

Word of conclusion

Most of the time there are alternative methods to the JTAG interface. You can check the datasheet and manuals of the device to find which native protocols are available. You can check with the manufacturer documentation to see if other methods are provided.

Implementing a RS232 like serial protocol will generally be easiest. Using the USB interface often means using "serial-over-USB". If you choose to use the JTAG interface, I recommend that you use the available JTAG tools.

\$\endgroup\$
0
\$\begingroup\$

Are simple wires/jumper cables not enough...?

A typical programmable part has a small number of pins that are used to program it. Probably at least two, maybe a few more. The hardware on the chip speaks some kind of protocol by which the programming data can be sent, in serial fashion, preferably in less time than it takes you to go out to lunch.

Yes. You can connect simple wires to those pins. But to what will you connect the other ends of those simple wires? Your computer probably doesn't have any port that speaks the programming protocol. In fact, if your computer is less than twenty years old, it probably does not have any port with pins that could be "bit banged" by software to implement the protocol.

Your computer probably has some kind(s) of USB port.

You need a device that plugs in to a USB port, An adapter that can speak USB protocols to your computer, and can speak the programming protocol to your programmable part.

That device is the "programmer" or "programming pod" or whatever you want to call it.

So actually (at another level) No. Simple wires aren't enough. You need that programmer.


to program a evaluation board you don't need this kind of device.

Yeah. Actually you do, but it's already built-in to the eval board. It's probably a microcontroller. Probably in a relatively small package (it only needs enough pins for the USB interface and a few more pins to interface with the "main" part on your eval board.

The programmer built-in to your eval board probably also implements a UART, and it probably has a few pins attached to a "debug console" port on the main part that you're evaluating. Makes the eval kit all the more appealing because you can program the device, debug the device, and talk to your code running on the device all through a single USB cable.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.