Skip to content

Commit 9598724

Browse files
maxd-nordicnordicjm
authored andcommitted
applications: connectivity_bridge: thingy91 debug
Add the CMSIS-DAP feature of the thingy91x to the thingy91. Signed-off-by: Maximilian Deubel <[email protected]>
1 parent b91e5ab commit 9598724

File tree

6 files changed

+30
-4
lines changed

6 files changed

+30
-4
lines changed

applications/connectivity_bridge/boards/thingy91_nrf52840.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,14 @@ CONFIG_USB_DEVICE_PRODUCT="Thingy:91 UART"
2828

2929
CONFIG_USB_DEVICE_VID=0x1915
3030
CONFIG_USB_DEVICE_PID=0x9100
31+
32+
CONFIG_USB_MAX_NUM_TRANSFERS=8
33+
CONFIG_BRIDGE_CMSIS_DAP_BULK_ENABLE=y
34+
35+
CONFIG_DAP=y
36+
CONFIG_DP_DRIVER=y
37+
38+
CONFIG_CMSIS_DAP_DEVICE_VENDOR="Nordic Semiconductor ASA"
39+
CONFIG_CMSIS_DAP_DEVICE_NAME="nrf91"
40+
41+
CONFIG_USB_CDC_ACM_RINGBUF_SIZE=15360

applications/connectivity_bridge/boards/thingy91_nrf52840_readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ https://nordicsemi.com/thingy91
88
This USB interface has the following functions:
99
* Disk drive containing this file and others
1010
* COM ports for nRF91 debug, trace, and firmware update
11+
* CMSIS-DAP 2.1 compliant debug probe interface for accessing the nRF91 SiP
1112

1213
COM Ports
1314
====================

applications/connectivity_bridge/boards/thingy91x_nrf5340_cpuapp.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@ CONFIG_DP_DRIVER=y
4343

4444
CONFIG_CMSIS_DAP_DEVICE_VENDOR="Nordic Semiconductor ASA"
4545
CONFIG_CMSIS_DAP_DEVICE_NAME="nrf91"
46+
47+
CONFIG_BRIDGE_CMSIS_DAP_NORDIC_COMMANDS=y

applications/connectivity_bridge/src/modules/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ target_sources_ifdef(CONFIG_BRIDGE_MSC_ENABLE
2020
app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/fs_handler.c)
2121

2222
target_sources_ifdef(CONFIG_BRIDGE_CMSIS_DAP_BULK_ENABLE
23-
app PRIVATE
24-
${CMAKE_CURRENT_SOURCE_DIR}/usb_bulk_commands.c
25-
${CMAKE_CURRENT_SOURCE_DIR}/usb_bulk_interface.c)
23+
app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/usb_bulk_interface.c)
24+
25+
target_sources_ifdef(CONFIG_BRIDGE_CMSIS_DAP_NORDIC_COMMANDS
26+
app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/usb_bulk_commands.c)

applications/connectivity_bridge/src/modules/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ config BRIDGE_CMSIS_DAP_BULK_ENABLE
2929
depends on USB_DEVICE_STACK
3030
select USB_DEVICE_BOS
3131

32+
config BRIDGE_CMSIS_DAP_NORDIC_COMMANDS
33+
bool "Enable Nordic specific commands"
34+
depends on BRIDGE_CMSIS_DAP_BULK_ENABLE
35+
help
36+
This option enables Nordic specific commands for CMSIS-DAP Bulk.
37+
Currently, these are only relevant for the Thingy:91 X board.
38+
3239
if BRIDGE_CMSIS_DAP_BULK_ENABLE
3340

3441
module = BRIDGE_BULK

applications/connectivity_bridge/src/modules/usb_bulk_interface.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <zephyr/usb/msos_desc.h>
1313
#include <zephyr/net_buf.h>
1414
#include <usb_descriptor.h>
15+
#include <cmsis_dap.h>
1516

1617
#define MODULE bulk_interface
1718
#include "module_state_event.h"
@@ -173,8 +174,11 @@ static int dap_usb_process(void)
173174
static uint8_t tx_buf[USB_BULK_PACKET_SIZE];
174175
struct net_buf *buf = k_fifo_get(&dap_rx_queue, K_FOREVER);
175176
uint8_t ep = dapusb_config.endpoint[DAP_USB_EP_IN_IDX].ep_addr;
176-
177+
#if defined(CONFIG_BRIDGE_CMSIS_DAP_NORDIC_COMMANDS)
177178
len = dap_execute_vendor_cmd(buf->data, tx_buf);
179+
#else
180+
len = dap_execute_cmd(buf->data, tx_buf);
181+
#endif /* defined(CONFIG_BRIDGE_CMSIS_DAP_NORDIC_COMMANDS) */
178182
LOG_DBG("response length %u, starting with [0x%02X, 0x%02X]", len, tx_buf[0], tx_buf[1]);
179183
net_buf_unref(buf);
180184

0 commit comments

Comments
 (0)