JTAG was the traditional mechanism for debug connections for ARM7/9 parts, but with the Cortex-M family, ARM introduced the Serial Wire Debug (SWD) Interface. SWD is designed to reduce the pin count required for debug from the 5 used by JTAG (including GND) down to 3. In addition, one of the pins freed up by this can be used for the low cost SWO tracing technology - for more details see the FAQ "".
The SWD/SWV pins are overlaid on top of the JTAG pins as follows:
|JTAG Mode||SWD Mode||Signal||Required pull-up / pull-down (if not implemented internally by MCU)|
|TCK||SWCLK||Clock into the core||Use 10K-100K Ohm pull-down resistor to GND|
|TDI||-||JTAG Test Data Input||Use 10K-100K Ohm pull-up resistor to VCC|
|TDO||SWV||JTAG Test Data Output / SWV trace data output (SWO)||Use 10K-100K Ohm pull-up resistor to VCC|
|TMS||SWDIO||JTAG Test Mode Select / SWD data in/out||Use 10K-100K Ohm pull-up resistor to VCC|
Some MCUs do not include internal pull-up or pull-down resistors on JTAG/SWD pins. You will need to review the datasheet for the specific MCU being used to confirm. Where internal resistors are not provided, these should be added externally onto your board as detailed above. You may use resistors between 10K and 100K for these signals. This will prevent the signals from floating when they are not connected to anything. Failure to do this will lead to, at best, unreliable debug connections, or more likely no ability to debug at all.
If an internal resistor is provided for a pin by the MCU, then an external resistor is not required for that pin. But if external resistor is provided in such cases, then it must match that provided internally by the MCU.
Note for TCK/SWCLK, although a pull-down is recommended, you can alternatively use a pull-up. The main thing is that it does not float. Note in particular that if the MCU provides an internal pull-up on this signal, then adding an external pull-down on the board is not recommended.
Note Cortex-M0/M0+ parts do not support SWV trace.
When designing your board, you should also take the following signals into account for debug purposes. Failure to do this will lead to, at best, unreliable debug connections, or more likely no ability to debug at all.
VTref (the Voltage Target Reference pin, direction from target to debug probe) supplies some debug probes such as LPC-Link2 and Red Probe+ with the debug rail voltage of the target to match its I/O logic level. VTref can be tied directly to the target VDDIO rail or through a resistor. If VTref is tied high through a resistor, its value must be no greater than 100Ω.
The original LPC-Link1 only supported 3.3V and did not require VTref whereas the LPC-Link2 uses dual-supply buffers that allows the Link2 to work with targets using a different voltage (between 1.8V - 4.3V).
On the LPC-Link2, when JP2 is shunted this will power the target side of the dual-supply buffer and provide power to the target through a diode on VTref. With JP2 open the target must supply the VTref to power the target side of the dual-supply buffer.
When a debug probe attempts to adjust logic levels based on the voltage it sees on VTref, this is referenced to whatever GND it has to work with. The voltage at VTref is coming from your target, thus you need a good GND, shared with your target hardware.
Note that debug probes can be killed (like most USB devices) by excessive over current through ground of the probe and back through the PC used for debugging. The usual cause of this is that your target has it's own PSU and has a ground differential slightly different from your debug PC. Please do not rely on your debug probe to ground your PC to the same potential as your target.
Even when you have designed your debug circuit according to the above considerations, you should also check that sufficient power is being supplied to your target in order to obtain a reliable debug connection. If you are using a USB port on your PC to power your target, make sure that your PC is able to supply the required power over USB - many PC USB ports do not meet USB power requirements.
ARM has defined three debug connector pinouts that are in common use, a "traditional" 20 pin connector, a Cortex 10 pin connector and a Cortex 20 pin Debug+ETM connector...
NOTE : LPC-Link2 (in both standalone form and as built in to the LPCXpresso V2 / V3 boards) has the ability to force an ISP reset via pin 7 of the Cortex 10-pin 0.05" JTAG/SWD Connector. For more details see the FAQ "".
Some debug probes (such as Red Probe+) may be provided with a "traditional" 20-way cable to connect to your board. If your board is only fitted with a 10-pin connector, then the simplest way to connect the two will be to use an adapter to convert between 10 and 20 pins. For example :Embedded Artists 10-PIN TO 20-PIN JTAG ADAPTER
These same adapters can also be used to allow a probe that assumes a 10-pin connector (such as LPC-Link or LPC-Link2) to be attached to a board with a "traditional" 20pin connector.
A similar adapter suitable for allowing an LPC-Link2 to connect to board with a 20pin connector is also available from SEGGER : 9-Pin Cortex-M Adapter
Some Cortex-M based MCUs support both SWD and JTAG, others support only SWD (such as NXP LPC11xx and LPC13xx). Where both are supported, there are special sequences defined to switch from JTAG mode (default) to SWD mode (and vice versa) that can sent to the core. This switch sequence uses TMS (SWDIO), and this line is connected for any SWD/JTAG connection
Normally where both modes are supported, LPCXpresso IDE will default to using SWD mode (the main exeception to this is LPC43xx). However this can be modified by editing the launch configuration for a project.