2024-07-07 04:39 PM
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 :)
2024-07-08 04:09 AM
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
2024-07-08 04:59 AM
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:
which I have never used.
hth
KnarfB
2024-07-08 06:06 AM
> 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
2024-07-08 06:45 AM
Yes, that's the hardware cost. Plus your SW investments into tracing (logging).
2024-07-08 07:59 AM
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 :)
2024-07-08 08:28 AM - edited 2024-07-08 08:34 AM
The SWO is like a extra serial connection, so you can send debug info (printf ( "main loop started. \n" ) ),
but you can get also interesting info like :
your serial msg:
and same from some usb actions: (debug msg enabled)
live chart from a value/variable :
cpu use :
AND important : without stopping the cpu in debug ! CPU just running, no changed timing (except the time, it needs to printf() , but this is then in your program, so always same timing, using it or not.)
2024-07-08 08:37 AM - edited 2024-07-08 08:38 AM
@Ricko wrote:But one PCB also has the JTAG_SWO (sic?) connected to the micro.
I think that's a misnomer?
SWO is not part of JTAG - it's an extension of SWD:
ARM's documentation of JTAG/SWD:
https://developer.arm.com/documentation/101636/0100/Debug-and-Trace/JTAG-SWD-Interface
2024-07-08 09:15 AM - edited 2024-07-08 09:27 AM
Your inability to look anything up, or query a search engine or ask ChatGPT seems prodigious..
SWO/TDO (PB3) is part of the JTAG complement, the ability to get the data back from the scan-chain, so boundary scan, daisy-chaining
One most, other than the CM0(+), it provides for the Serial Wire Viewer (SWV)
https://developer.arm.com/documentation/kan297/latest/
For proper Trace support you looking at pods running several $1000 USD, and more pins and a 20-pin header
The CM0(+) support SWD only, not JTAG, and frequently at lower speeds, typically a couple of MHz, not 10's. Use Event Recorder (EVR) methods rather than SWO/SWV
https://www.keil.com/download/files/swv_on_cortex-m3.pdf
https://www.keil.com/appnotes/files/apnt_321_v0.96.pdf
2024-07-09 03:22 AM
Thank you all, much appreciated.