Skip to content

Commit

Permalink
applications: connectivity_bridge: thingy91 debug
Browse files Browse the repository at this point in the history
Add the CMSIS-DAP feature of the thingy91x to the thingy91.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
(cherry picked from commit 9598724)
  • Loading branch information
maxd-nordic authored and github-actions[bot] committed Nov 14, 2024
1 parent a2386bf commit fc3b80e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 4 deletions.
11 changes: 11 additions & 0 deletions applications/connectivity_bridge/boards/thingy91_nrf52840.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,14 @@ CONFIG_USB_DEVICE_PRODUCT="Thingy:91 UART"

CONFIG_USB_DEVICE_VID=0x1915
CONFIG_USB_DEVICE_PID=0x9100

CONFIG_USB_MAX_NUM_TRANSFERS=8
CONFIG_BRIDGE_CMSIS_DAP_BULK_ENABLE=y

CONFIG_DAP=y
CONFIG_DP_DRIVER=y

CONFIG_CMSIS_DAP_DEVICE_VENDOR="Nordic Semiconductor ASA"
CONFIG_CMSIS_DAP_DEVICE_NAME="nrf91"

CONFIG_USB_CDC_ACM_RINGBUF_SIZE=15360
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ https://nordicsemi.com/thingy91
This USB interface has the following functions:
* Disk drive containing this file and others
* COM ports for nRF91 debug, trace, and firmware update
* CMSIS-DAP 2.1 compliant debug probe interface for accessing the nRF91 SiP

COM Ports
====================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ CONFIG_DP_DRIVER=y

CONFIG_CMSIS_DAP_DEVICE_VENDOR="Nordic Semiconductor ASA"
CONFIG_CMSIS_DAP_DEVICE_NAME="nrf91"

CONFIG_BRIDGE_CMSIS_DAP_NORDIC_COMMANDS=y
7 changes: 4 additions & 3 deletions applications/connectivity_bridge/src/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ target_sources_ifdef(CONFIG_BRIDGE_MSC_ENABLE
app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/fs_handler.c)

target_sources_ifdef(CONFIG_BRIDGE_CMSIS_DAP_BULK_ENABLE
app PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/usb_bulk_commands.c
${CMAKE_CURRENT_SOURCE_DIR}/usb_bulk_interface.c)
app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/usb_bulk_interface.c)

target_sources_ifdef(CONFIG_BRIDGE_CMSIS_DAP_NORDIC_COMMANDS
app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/usb_bulk_commands.c)
7 changes: 7 additions & 0 deletions applications/connectivity_bridge/src/modules/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ config BRIDGE_CMSIS_DAP_BULK_ENABLE
depends on USB_DEVICE_STACK
select USB_DEVICE_BOS

config BRIDGE_CMSIS_DAP_NORDIC_COMMANDS
bool "Enable Nordic specific commands"
depends on BRIDGE_CMSIS_DAP_BULK_ENABLE
help
This option enables Nordic specific commands for CMSIS-DAP Bulk.
Currently, these are only relevant for the Thingy:91 X board.

if BRIDGE_CMSIS_DAP_BULK_ENABLE

module = BRIDGE_BULK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <zephyr/usb/msos_desc.h>
#include <zephyr/net_buf.h>
#include <usb_descriptor.h>
#include <cmsis_dap.h>

#define MODULE bulk_interface
#include "module_state_event.h"
Expand Down Expand Up @@ -173,8 +174,11 @@ static int dap_usb_process(void)
static uint8_t tx_buf[USB_BULK_PACKET_SIZE];
struct net_buf *buf = k_fifo_get(&dap_rx_queue, K_FOREVER);
uint8_t ep = dapusb_config.endpoint[DAP_USB_EP_IN_IDX].ep_addr;

#if defined(CONFIG_BRIDGE_CMSIS_DAP_NORDIC_COMMANDS)
len = dap_execute_vendor_cmd(buf->data, tx_buf);
#else
len = dap_execute_cmd(buf->data, tx_buf);
#endif /* defined(CONFIG_BRIDGE_CMSIS_DAP_NORDIC_COMMANDS) */
LOG_DBG("response length %u, starting with [0x%02X, 0x%02X]", len, tx_buf[0], tx_buf[1]);
net_buf_unref(buf);

Expand Down

0 comments on commit fc3b80e

Please sign in to comment.