routing jtag signals through an FPGA

I am routing a JTAG signals through an Altera FPGA to a TI MCU. The signals are TMS, TCK, TDO, TDI, nSRST.

I can also connect the JTAG directly to to the MCU as there is a 10 pin jtag header exposed on it.

If I route the signals TCK, TDI, TDO, nSRST through the FPGA and connect TMS directly to the TMS to the 10 pin jtag header on the MCU then it will flash the device.

However, if I route TMS through the FPGA the flashing fails.

I have analysed the TMS signals both through the FPGA and directly to the 10 pin header on the MCU and both look equally nosiy.

Would anyone know any properties of the FPGA that would contribute to this error.

Also could anybody suggestion a solution. Would latching the signal work and if so could anybody explain this in further detail.

• Possibly related to propagation delays through the FPGA. Might be worth seeing if you can drop the clock frequency of the JTAG comms. – Tom Carpenter Jul 9 '17 at 13:34

The JTAG (boundary scan) state machine moves through states based on the level of TMS at the rising edge of TCK.

Routing TMS through the FPGA is adding (some unknown) delay to TMS so it not surprising the chain fails to operate as expected.

There are devices designed to operate multiple chains, such as the devices from Firecron (if that was what you were attempting to do).

In normal circumstances (boundary scan controllers have come a long way), I just connect every TMS together (TCK gets the same treatment). The only signals passed through are TDI / TDO (not through your fabric - let the implemented boundary scan do it).

One interesting note: if you have a device without TRST, pull TCK low by default to avoid a potential power up race consition.

Some CPUs (especially ARM CPUs like the STM32) allow two kinds of "JTAG" transfer:

• Real JTAG with four wires (five wires including nSRST)
• Some "pseudo"-JTAG called "SWD" using only two wires: TCK and TMS

If SWD is used the TMS line is bi-directional!

If flashing works with only TCK and TMS connected (and TDI and TDO disconnected) you know that the flash tool uses SWD.

On the other hand if flashing does not work with only two pins connected you cannot know if the flash tool uses only JTAG or if it uses both JTAG and SWD.

• @Peter Smith and Martin Rosenau, thank you for your helpful replies. The MCUs I am trying to flash are TI CC2650s. I have multiple MCU connected to an FPGA so that I can mux the signals to the appropriate MCU. I am using an XDS100v3 debugger with TIs uniflash linux based flashing tool. I am pretty sure that the tool relies on the 5 wire version of JTAG though. I believe the issue is related to a very noisy TMS signal. – artic sol Jul 10 '17 at 11:48