README.rst
1.. zephyr:code-sample:: cmsis-dap
2 :name: CMSIS-DAP
3
4 Implement a custom CMSIS-DAP controller using SWDP interface driver.
5
6Overview
7********
8
9This sample app demonstrates use of a SWDP interface driver and CMSIS DAP
10controller through USB Bulk interface.
11
12Requirements
13************
14
15This sample supports multiple hardware configurations:
16
17The simplest configuration would be to connect ``SWDIO`` to ``dio``, ``SWDCLK`` to ``clk``
18and optionally ``nRESET`` to ``reset``. The optional ``noe`` pin is used to enable the port,
19e.g. if the SWD connections are multiplexed.
20
21Building and Running
22********************
23
24In order for our debug adapter to be recognized by pyOCD we need to change
25Zephyr's VID/PID to IDs known to pyOCD, this is up to the user.
26The following commands build and flash DAP sample.
27
28.. zephyr-app-commands::
29 :zephyr-app: samples/subsys/dap
30 :board: nrf52840dk_nrf52840
31 :goals: flash
32 :compact:
33
34Connect HIC to the target and try some pyOCD commands, for example:
35
36.. code-block:: console
37
38 pyocd commander -t nrf52840
39
40 0029527 W Board ID FE5D is not recognized [mbed_board]
41 Connected to NRF52840 [Sleeping]: FE5D244DFE1F33DB
42 pyocd> read32 0x20004f18 32
43 20004f18: 20001160 2000244c 00000000 0000e407 | ..` .$L........|
44 20004f28: ffffffff ffffffff 00000000 aaaaaaaa |................|
45 pyocd> halt
46 Successfully halted device
47 pyocd> reg
48 general registers:
49 lr: 0x00009cdd r7: 0x00000000 (0)
50 pc: 0x000033ca r8: 0x00000000 (0)
51 r0: 0x00000000 (0) r9: 0x00000000 (0)
52 r1: 0x20002854 (536881236) r10: 0x00000000 (0)
53 r2: 0x20000be4 (536873956) r11: 0x00000000 (0)
54 r3: 0x00000000 (0) r12: 0x00000000 (0)
55 r4: 0x200017e8 (536877032) sp: 0x20002898
56 r5: 0x20001867 (536877159) xpsr: 0x61000000 (1627389952)
57 r6: 0x00000000 (0)
58