SWD protocol

XJTAG supports SWD for a single target device, providing functions to read and write using the SWD protocol. Functions are also provided for taking manual control of the bidirectional communication.

To enable SWD in a project the SWDIO and SWDCLK pins must be defined from the Pin Mapping screen.

Only one pair of SWDIO and SWDCLK pins are supported within a project.

SWD uses the same frequency setting as JTAG. This can be set using SETFREQ and retrieved using GETFREQ. The update to update interval has no impact on SWD.

The following functions are available:

SWD block
Switches a target to SWD mode using the 'Switching Mechanism'.
SWD_READ
Performs a read using the SWD protocol.
SWD_WRITE
Performs a write using the SWD protocol.
SWD_RAW_SEND
Send raw data to the device using the SWD pins.
SWD_RAW_RECEIVE
Receive raw data from the device using the SWD pins.

XJTAG v4.1 added a number of functions to handle errors returned by the SWD protocol:

SWD_EXIT_ON_ERROR
Define whether errors should immediately fail the test or not.
SWD_GET_LAST_RESPONSE
Get the last error from an SWD scan.
SWD_GET_RESPONSE_COUNTERS
Get the responses counters for SWD protocol scans.
SWD_RESET_RESPONSE_COUNTERS
Reset the response counters for SWD protocol scans.

Details of how to use the Arm Debug Interface SWD Protocol are available from Arm.