SWD_RAW_RECEIVE
The SWD_RAW_RECEIVE function receives raw data on the SWD pins. Receiving data via this function bypasses XJTAG's handling of the bidirectional nature of the protocol, and will clock in the next bitLength bits irrespective of the state of the interface.
If SWD pins are shared with JTAG TAP pins, the first JTAG access after using SWD_RAW_RECEIVE will reset the JTAG chain.
Syntax
SWD_RAW_RECEIVE( INT bitLength )
Parameters
- bitLength
- The number of bits of data to receive. Must be at least 1, and a maximum of 65520.
Return value
An INT value containing the received data bits returned on success of the function (LSB is the first received).
Example
INT data, ack, idcode, parityBit, parityError; SWD // Places the target into SWD mode // Using raw functions to manually use the bidirectional protocol SWD_RAW_SEND(8, 0b10100101); // Request id code. [0]start=0b1, [1]debug port=0b0, [2]read=0b1, // [3..4]address=0b00, [5]parity=0b1, [6]stop=0b0, [7]park=0b1. SWD_RAW_RECEIVE(4)(data); // Receive the acknowledgement. [0]turnaround bit, [1]OK, [2]wait, [3]fault. ack := data[3..1]; PRINT("Acknowledgement: ", FORMAT(ack, "%#03b\n")); IF ack != 0b001 THEN EXIT; END; // Check it returned the OK response. SWD_RAW_RECEIVE(33)(data); // Receive the data [0..31]data, [32]parity. idcode := data[31..0]; parityBit := data[32]; PRINT("IDCODE: ", FORMAT(data, "%#08x\n")); PRINT("Parity Bit: ", parityBit, "\n\n"); END; SWD // The same thing achieved using the built-in protocol functions SWD_EXIT_ON_ERROR(FALSE); SWD_READ(0, 0)(idcode, ack, parityError); // Debug port, address 0. PRINT("IDCODE: ", FORMAT(data, "%#08x\n")); PRINT("Acknowledgement: ", FORMAT(ack, "%#03b\n")); PRINT("Parity Error: ", parityError, "\n"); END;
Acknowledgement: 0b001 IDCODE: 0x2ba01477 Parity Bit: 0 IDCODE: 0x2ba01477 Acknowledgement: 0b001 Parity Error: 0
See also
- SWD_RAW_SEND
- More details of how to use the Arm Debug Interface SWD Protocol are available from Arm
XJTAG v4.1.100