Standard I/O Pins of the CMSIS-DAP Hardware Debug Port support standard JTAG mode and Serial Wire Debug (SWD) mode. In SWD mode only 2 pins are required to implement the debug interface of a device. The following I/O Pins are provided:
JTAG I/O Pin | SWD I/O Pin | CMSIS-DAP Hardware pin mode |
TCK: Test Clock | SWCLK: Clock | Output Push/Pull |
TMS: Test Mode Select | SWDIO: Data I/O | Output Push/Pull; Input (for receiving data) |
TDI: Test Data Input | | Output Push/Pull |
TDO: Test Data Output | | Input |
nTRST: Test Reset (optional) | | Output Open Drain with pull-up resistor |
nRESET: Device Reset | nRESET: Device Reset | Output Open Drain with pull-up resistor |
DAP Hardware I/O Pin Access Functions
The various I/O Pins are accessed by functions that implement the Read, Write, Set, or Clear to these I/O Pins.
For the SWDIO I/O Pin there are additional functions that are called in SWD I/O mode only. This functions are provided to achieve faster I/O that is possible with some advanced GPIO peripherals that can independently write/read a single I/O pin without affecting any other pins of the same I/O port. The following SWDIO I/O Pin functions are provided:
◆ PIN_nRESET_IN()
__STATIC_FORCEINLINE uint32_t PIN_nRESET_IN |
( |
void |
| ) |
|
nRESET I/O pin: Get Input.
- Returns
- Current status of the nRESET DAP hardware I/O pin.
◆ PIN_nRESET_OUT()
__STATIC_FORCEINLINE void PIN_nRESET_OUT |
( |
uint32_t |
bit | ) |
|
nRESET I/O pin: Set Output.
- Parameters
-
bit | target device hardware reset pin status:
- 0: issue a device hardware reset.
- 1: release device hardware reset.
|
◆ PIN_nTRST_IN()
__STATIC_FORCEINLINE uint32_t PIN_nTRST_IN |
( |
void |
| ) |
|
nTRST I/O pin: Get Input.
- Returns
- Current status of the nTRST DAP hardware I/O pin.
◆ PIN_nTRST_OUT()
__STATIC_FORCEINLINE void PIN_nTRST_OUT |
( |
uint32_t |
bit | ) |
|
nTRST I/O pin: Set Output.
- Parameters
-
bit | JTAG TRST Test Reset pin status:
- 0: issue a JTAG TRST Test Reset.
- 1: release JTAG TRST Test Reset.
|
◆ PIN_SWCLK_TCK_CLR()
__STATIC_FORCEINLINE void PIN_SWCLK_TCK_CLR |
( |
void |
| ) |
|
SWCLK/TCK I/O pin: Set Output to Low. Set the SWCLK/TCK DAP hardware I/O pin to low level.
◆ PIN_SWCLK_TCK_IN()
__STATIC_FORCEINLINE uint32_t PIN_SWCLK_TCK_IN |
( |
void |
| ) |
|
SWCLK/TCK I/O pin: Get Input.
- Returns
- Current status of the SWCLK/TCK DAP hardware I/O pin.
◆ PIN_SWCLK_TCK_SET()
__STATIC_FORCEINLINE void PIN_SWCLK_TCK_SET |
( |
void |
| ) |
|
SWCLK/TCK I/O pin: Set Output to High. Set the SWCLK/TCK DAP hardware I/O pin to high level.
◆ PIN_SWDIO_IN()
__STATIC_FORCEINLINE uint32_t PIN_SWDIO_IN |
( |
void |
| ) |
|
SWDIO I/O pin: Get Input (used in SWD mode only).
- Returns
- Current status of the SWDIO DAP hardware I/O pin.
◆ PIN_SWDIO_OUT()
__STATIC_FORCEINLINE void PIN_SWDIO_OUT |
( |
uint32_t |
bit | ) |
|
SWDIO I/O pin: Set Output (used in SWD mode only).
- Parameters
-
bit | Output value for the SWDIO DAP hardware I/O pin. |
◆ PIN_SWDIO_OUT_DISABLE()
__STATIC_FORCEINLINE void PIN_SWDIO_OUT_DISABLE |
( |
void |
| ) |
|
SWDIO I/O pin: Switch to Input mode (used in SWD mode only). Configure the SWDIO DAP hardware I/O pin to input mode. This function is called prior PIN_SWDIO_IN function calls.
◆ PIN_SWDIO_OUT_ENABLE()
__STATIC_FORCEINLINE void PIN_SWDIO_OUT_ENABLE |
( |
void |
| ) |
|
SWDIO I/O pin: Switch to Output mode (used in SWD mode only). Configure the SWDIO DAP hardware I/O pin to output mode. This function is called prior PIN_SWDIO_OUT function calls.
◆ PIN_SWDIO_TMS_CLR()
__STATIC_FORCEINLINE void PIN_SWDIO_TMS_CLR |
( |
void |
| ) |
|
SWDIO/TMS I/O pin: Set Output to Low. Set the SWDIO/TMS DAP hardware I/O pin to low level.
◆ PIN_SWDIO_TMS_IN()
__STATIC_FORCEINLINE uint32_t PIN_SWDIO_TMS_IN |
( |
void |
| ) |
|
SWDIO/TMS I/O pin: Get Input.
- Returns
- Current status of the SWDIO/TMS DAP hardware I/O pin.
◆ PIN_SWDIO_TMS_SET()
__STATIC_FORCEINLINE void PIN_SWDIO_TMS_SET |
( |
void |
| ) |
|
SWDIO/TMS I/O pin: Set Output to High. Set the SWDIO/TMS DAP hardware I/O pin to high level.
◆ PIN_TDI_IN()
__STATIC_FORCEINLINE uint32_t PIN_TDI_IN |
( |
void |
| ) |
|
TDI I/O pin: Get Input.
- Returns
- Current status of the TDI DAP hardware I/O pin.
◆ PIN_TDI_OUT()
__STATIC_FORCEINLINE void PIN_TDI_OUT |
( |
uint32_t |
bit | ) |
|
TDI I/O pin: Set Output.
- Parameters
-
bit | Output value for the TDI DAP hardware I/O pin. |
◆ PIN_TDO_IN()
__STATIC_FORCEINLINE uint32_t PIN_TDO_IN |
( |
void |
| ) |
|
TDO I/O pin: Get Input.
- Returns
- Current status of the TDO DAP hardware I/O pin.
◆ PORT_JTAG_SETUP()
__STATIC_INLINE void PORT_JTAG_SETUP |
( |
void |
| ) |
|
Setup JTAG I/O pins: TCK, TMS, TDI, TDO, nTRST, and nRESET. Configures the DAP Hardware I/O pins for JTAG mode:
- TCK, TMS, TDI, nTRST, nRESET to output mode and set to high level.
- TDO to input mode.
◆ PORT_OFF()
__STATIC_INLINE void PORT_OFF |
( |
void |
| ) |
|
Disable JTAG/SWD I/O Pins. Disables the DAP Hardware I/O pins which configures:
- TCK/SWCLK, TMS/SWDIO, TDI, TDO, nTRST, nRESET to High-Z mode.
◆ PORT_SWD_SETUP()
__STATIC_INLINE void PORT_SWD_SETUP |
( |
void |
| ) |
|
Setup SWD I/O pins: SWCLK, SWDIO, and nRESET. Configures the DAP Hardware I/O pins for Serial Wire Debug (SWD) mode:
- SWCLK, SWDIO, nRESET to output mode and set to default high level.
- TDI, nTRST to HighZ mode (pins are unused in SWD mode).