chipset/zephyr: add guide to turn nrf5340 development boards into HCI USB dongles

This commit is contained in:
Dirk Helbig 2023-12-21 07:43:54 +01:00 committed by Matthias Ringwald
parent 5f1af52084
commit 421ee5a81f
3 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,48 @@
# nRF5340 (Audio) DK Board as USB HCI Dongle Guide
This will turn the Nordic nRF5340 DK and Audio DK boards into an USB CDC HCI dongle.
If using the NRF Connect SDK ( sdk-nrf ) it is important to follow the order in this document, as 'west flash'
will also program the NetCore with zephyr-ll which needs to be replaced afterwards with the Packetcraft Link Layer.
## Preconditions
Copy the included files to '${ZEPHYR_ROOT}/zephyr/examples/bluetooth/hci_uart/'
## Build/Flash HCI Bridge on AppCore
You need to specify the board with the '-b' param in the west call.
For nRF5340 DK:
```sh
cd ${ZEPHYR_ROOT}/zephyr/samples/bluetooth/hci_uart/
west build --pristine -b nrf5340dk_nrf5340_cpuapp -- -DDTC_OVERLAY_FILE=usb.overlay -DOVERLAY_CONFIG=overlay-usb.conf
west flash
```
For nRF5340 Audio DK (ADK)
```sh
cd ${ZEPHYR_ROOT}/zephyr/samples/bluetooth/hci_uart/
west build --pristine -b nrf5340_audio_dk_nrf5340_cpuapp -- -DDTC_OVERLAY_FILE=usb.overlay -DOVERLAY_CONFIG=overlay-usb.conf
west flash
```
## Flash Packetcraft Link Layer on NetCore
```sh
nrfjprog --program ble5-ctr-rpmsg_3424.hex --chiperase --coprocessor CP_NETWORK -r --verify
```
the corresponding hex file is in the [nrfConnectSDK](https://github.com/nrfconnect/sdk-nrf/blob/main/lib/bin/bt_ll_acs_nrf53/bin)
## Usage / Find Serial Port
On macOS, the nRF5340 with the HCI bridge show up as 5 /dev/tty. To find the HCI one, list all /dev/tty.* devices,
then press and hold the RESET button and list all devices again. The missing one is the one provided by the HCI bridge.
## HCI log
```sh
btmon -J nrf5340_xxaa_app -w <logfile>
```

View File

@ -0,0 +1,53 @@
#USB stuff
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Zephyr HCI UART sample"
CONFIG_USB_CDC_ACM=y
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
#CONFIG_USB_DEVICE_LOG_LEVEL_DBG=y
# stack
#CONFIG_ISR_STACK_SIZE=8192
#CONFIG_IDLE_STACK_SIZE=8192
#CONFIG_MAIN_STACK_SIZE=8192
#CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192
#CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=8192
#CONFIG_HEAP_MEM_POOL_SIZE=8192
# Enable ISO support
CONFIG_BT_ISO_BROADCASTER=y
CONFIG_BT_ISO_TX_BUF_COUNT=10
CONFIG_BT_ISO_TX_MTU=251
CONFIG_BT_ISO_RX_BUF_COUNT=10
CONFIG_BT_ISO_RX_MTU=251
# setup rpmsg/Bluetooth buffer
CONFIG_BT_BUF_EVT_RX_COUNT=16
CONFIG_BT_BUF_EVT_RX_SIZE=255
CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255
#debug stuff
#CONFIG_ASSERT=y
#CONFIG_THREAD_NAME=y
#CONFIG_THREAD_ANALYZER=y
#CONFIG_THREAD_ANALYZER_AUTO=y
#CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y
#CONFIG_HW_STACK_PROTECTION=y
#CONFIG_CONSOLE=n
#CONFIG_LOG=y
#CONFIG_LOG_BUFFER_SIZE=4096
#CONFIG_RTT_CONSOLE=y
#CONFIG_UART_CONSOLE=n
#CONFIG_LOG_BACKEND_RTT=y
#CONFIG_LOG_BACKEND_RTT_MODE_DROP=n
#CONFIG_USE_SEGGER_RTT=y
#CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=2048
#CONFIG_LOG_BACKEND_SHOW_COLOR=n
#CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=8192
#CONFIG_LOG_DEFAULT_LEVEL=3

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
/ {
chosen {
zephyr,bt-c2h-uart = &cdc_acm_uart0;
};
};
&zephyr_udc0 {
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
};
};