Wednesday, September 14, 2016

JTAG, SWD and debugWIRE: How are they different ? Its always a question ..... Let me clarify

JTAG - Joint Test Application Group
- Its used for verifying design and testing PCB after manufacturing
- Its referred as IEEE Standard 1149.1
- Standard Test Access Port and Boundary-Scan Architecture
- Programming and debugging both can be done using JTAG

Physical interface:

  1. TDI (Tets Data In)
  2. TDO (Test Data Out)
  3. TCK (Tets Clock)
  4. TMS (Test Mode Select)
  5. TRST (Test Reset)
Daisy chain way of using JTAG

Example of JTAG chain


SWD - Serial Wire Debug

Serial Wire Debug (SWD) is debug port for microcontroller where package is small, or small number of pins.
Its used mostly in ARM architecture chips
SWD is availabel as a part of Core Sight Debug access port
Compatible with all ARM processors, and any processor that uses JTAG
- Programming and debugging both can be done using SWD
Physical interface: 
  1. SWCLK (Serial Wire Clock)
  2. SWDIO (Serial Wire Data In and Out)
In case when SWD is used for JTAG based process
  1. SWCLK --> TCK
  2. SWDIO --> TMS
With SWD protocol, the debugger is connected to AMBA bus as another master, using which debugger can access ARM core system and peripheral memory

NOTE:
Ofcourse, VCC and GND need to be common between In-Circuit-Debugger/Programmer and Processor

SWO (Serial wire out) wire is used sometimes along with SWCLK and SWDIO.
Some of the programmer and debuggers like STLINK provide debugging utility like printf(), which are very useful. These utilities use SWO wire to send serial data over it to PC. But here you need to set the system clock value correctly in the serial debug viewer configuration on PC.

debugWIRE

debug WIRE is a single wire interface provide in most Atmel AVR microcontrollers.
Its even more beneficial compared to JTAG and SWD as its very useful in places where package pin count is very small. On-Chip-Debugger (OCD) is provided on silicon itself by Atmel. dW single wire is internally connected to OCD. Whenever BREAK instruction (Software breakpooint) or (Hardware breakpoint) is observed by OCD, the CPU core operation is stopped and halted. All the SRAM, Peripheral register values, IO status information is sent by OCD over dW wire to the External Debugger unit(JTAGICE3). It will convert dW information to USB so that information could be sent to PC. On PC there will be a Debug software program which will grab the data and display it. Debug software running on PC will be a part of AtmelStudio.
- Only debugging both can be done using debugWIRE
- SPI interface is used for programming where dW debug interface is used



Physical interface:
Single wire dW.
Its a alternate functionality for RESET pin of the micro controller.

No comments:

Post a Comment

PROFILE

My photo
India
Design Engineer ( IFM Engineering Private Limited )

Followers