Skip to main content
Graduate II
July 7, 2024
Question

Debug protocols comparison and choice

  • July 7, 2024
  • 3 replies
  • 4424 views

Hi,

when it comes to programming and debugging, what is the difference between the 4 types (see screenshot below)?

Which one is best and how do you decide which one to use?

Please don't just say they all work the same pick one... :) I am asking for the pros and cons of each and how to choose one with a precise logic.

- Serial Wire

- JTAG 4 pins

- JTAG 5 pins

- Trace Asynchronous Sw

 

Thank you :)

 

Ricko_0-1720395325957.png

 

    This topic has been closed for replies.

    3 replies

    Super User
    July 8, 2024

    If you need to ask, you want to go for Serial Wire (SWD), as the 99% of users do, and as is the cheap and out-of-the-box option on boards like Nucleo with software like CubeIDE.

    To use JTAG of either form, you'd need some very good reason (e.g. you already have JTAG equipment you want to use, you want to perform boundary check - if you don't know what it is, you most probably don't need it), as it does not provide anything substantial beyond what SWD provides.

    Trace is an extra feature, you'd need some appropriate (read: definitivaly not simple and not cheap) hardware and software, and a target with many pins (so that it does have the trace pins which are usually only on many-pins packages).

    JW

     

    Super User
    July 8, 2024

    Application note AN4989 "STM32 microcontroller debug toolbox" has many details.

    Trace Asynchronous Sw is SWO tracing which is built-in in ST-LINK for cores that support it (M4 and better) and does not require additional tools and is quite useful. What @Jan Waclawek means, is synchronous tracing:

    Screenshot 2024-07-08 135537.png

    which I have never used.

    hth

    KnarfB

    Super User
    July 8, 2024

    > What @Jan Waclawek means, is synchronous tracing:

    I stand corrected, thanks.

    So, the only cost to "trace asynchronous sw" is the SWO pin, is it?

    JW

    Super User
    July 8, 2024

    Yes, that's the hardware cost. Plus your SW investments into tracing (logging).  

    RickoAuthor
    Graduate II
    July 8, 2024

    Thank you @KnarfB and @waclawek.jan 

    I have a Segger J-Link and am working on custom PCBs (not dev kits). Attached are both programming connectors and the signals connected to the micro.

    Both PCBs have JTMS-SWDIO, JTCK-SWCLK and MCLR conencted tot he micro.

    But one PCB also has the JTAG_SWO connected to the micro.

    So I assume I can use SWD for both.

    But what else can I use for the one PCB that also as the JTAG_SWO signal connected to the micro?

    And what advantage or functionality does that extra connection provide (I assume possibly in debugging)?

    Thank you :)

    Ricko_0-1720450522703.png

    Ricko_1-1720450581866.png

     

     

    RickoAuthor
    Graduate II
    July 9, 2024

    Thank you all, much appreciated.