Author Topic: To JTAG or SWD?  (Read 676 times)

0 Members and 1 Guest are viewing this topic.

Offline i509VCBTopic starter

  • Contributor
  • Posts: 33
  • Country: us
To JTAG or SWD?
« on: April 01, 2025, 07:01:43 am »
I am working on a project with the IMXRT1011. It has both SWD and JTAG support. I'm not running short on pins so either is fine.

More generally is there any real reason to use JTAG over SWD for microcontrollers? In my case the scan chain has a length of 1 so any features related to chains are pointless for me. The FPGA alongside the part on the board does not support JTAG (ice40) so I do not see the practical reason to use the extra 4 pins for JTAG.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4288
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: To JTAG or SWD?
« Reply #1 on: April 01, 2025, 07:31:36 am »
Wire up SWD with trace output.
The trace output can be really helpful if your debugger support it.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 16384
  • Country: fr
Re: To JTAG or SWD?
« Reply #2 on: April 01, 2025, 11:28:57 am »
I haven't used JTAG for MCUs in ages and see little reason for that these days if they support SWD, which all Cortex-M MCUs do (AFAIK).

The rationale to use JTAG if you have a chain of devices (and you mentioned that was not your case) can be defended in general, except that in practice, you may be using software debug/programming JTAG tools that do not support all of your different devices on the same chain, so that the practical benefits if you have a "hybrid" (chips from different vendors) JTAG chain can even be questionable anyway. Could allow a single JTAG connector on your board, provided that you're ok with accessing all devices with the least common denominator, meaning the lowest JTAG clock speed supported by any of them, at least those that pass JTAG on to others, which may not pass JTAG signals properly past a certain clock frequency.

Just a few things to consider when designing. Here, just use SWD.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4288
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: To JTAG or SWD?
« Reply #3 on: April 01, 2025, 01:15:05 pm »
Both JTAG and SWD talk to the same DAP (Debug Access Port), jtag just requires more pins.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 12017
  • Country: us
    • Personal site
Re: To JTAG or SWD?
« Reply #4 on: April 01, 2025, 02:13:03 pm »
JTAG is also less efficient in terms of clock cycles required to perform the same access. And on ARM it is also really awkward, since implementations include two virtual devices. One is the ARM core and another one is boundary scan. So, you get all the annoyances of working with multiple devices in a chain while you only care about one. There is no reason to use JTAG in cases when SWD is available.
Alex
 
The following users thanked this post: gryg

Offline bson

  • Supporter
  • ****
  • Posts: 2578
  • Country: us
Re: To JTAG or SWD?
« Reply #5 on: April 01, 2025, 06:55:38 pm »
Go SWD, unless you explictly need JTAG functionality (such as device chaining).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf