Bus fault on nRF52840 peripheral in BLE HCI USB Raw mode with 251-byte packets

While running the BLE HCI USB (bluetooth_hci_usb) sample in Raw mode on an nRF52840 board, we observe a bus fault under specific conditions. The fault occurs when the device is acting as a peripheral and receiving data packets of maximum length 251 bytes. Reducing the maximum data length to 120 bytes prevents the fault.

Environment:

Following is the prj.conf file settings.

CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_SERIAL=n
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n

CONFIG_USB_DEVICE_STACK_NEXT=y
CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=n
CONFIG_SAMPLE_USBD_PID=0x000B
CONFIG_SAMPLE_USBD_PRODUCT="Zephyr USBD BT HCI"
CONFIG_USBD_BT_HCI=y

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_AUTO_DATA_LEN_UPDATE=y
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_BUF_ACL_RX_COUNT=20
CONFIG_BT_BUF_ACL_TX_COUNT=12

Here is the initial log when the BLE HCI USB sample in Raw mode is started.

00> [00:00:00.000,396] <inf> udc_nrf: Preinit

00> *** Booting nRF Connect SDK v3.1.1-e2a97fe2578a ***
00> *** Using Zephyr OS v4.1.99-ff8f0c579eeb ***
00> [00:00:00.000,640] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
00> fc de 41 eb a2 d1 42 24 00 b5 f8 57 9f ac 9d 9e |..A...B$ ...W....
00> aa c9 b4 34 |...4
00> [00:00:00.001,037] <inf> bt_hci_raw: Lower HCI transport: SDC
00> [00:00:00.001,037] <inf> bt_hci_raw: Bluetooth enabled in RAW mode
00> [00:00:00.001,220] <inf> udc_nrf: Initialized
00> [00:00:00.001,220] <inf> usbd_init: interface 0 alternate 0
00> [00:00:00.001,251] <inf> usbd_init: ep 0x81 mps 0x0010 interface ep-bm 0x00020000
00> [00:00:00.001,281] <inf> usbd_init: ep 0x82 mps 0x0040 interface ep-bm 0x00060000
00> [00:00:00.001,312] <inf> usbd_init: ep 0x01 mps 0x0040 interface ep-bm 0x00060002

When I used the CONFIG_BT_CTLR_DATA_LENGTH_MAX as 120 bytes, it works fine. But when the CONFIG_BT_CTLR_DATA_LENGTH_MAX is increased to 251, I see the following error.

00> [00:41:24.006,164] <err> os: ***** BUS FAULT *****
00> [00:41:24.006,164] <err> os: Precise data bus error
00> [00:41:24.006,195] <err> os: BFAR Address: 0x1e32160
00> [00:41:24.006,195] <err> os: r0/a1: 0xffffffff r1/a2: 0x88000000 r2/a3: 0x01e32100
00> [00:41:24.006,225] <err> os: r3/a4: 0x00000018 r12/ip: 0x00000001 r14/lr: 0x0002200d
00> [00:41:24.006,225] <err> os: xpsr: 0x81000037
00> [00:41:24.006,225] <err> os: Faulting instruction address (r15/pc): 0x0002ac1e
00> [00:41:24.006,256] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
00> [00:41:24.006,286] <err> os: Fault during interrupt handling
00>
00> [00:41:24.006,317] <err> os: Current thread: 0x20003708 (unknown)
00> [00:41:24.703,704] <err> os: Halting system

Could you advise why this Bus Fault is occurring and suggest how to resolve it?

Parents Reply Children
  • Hello,

    I tried using HCI UART with USB CDC ACM UART (HCI UART). My hardware only supports USB, so I added CONFIG_CDC_ACM_SERIAL_PRODUCT_STRING to enable a virtual UART over USB. Below is the complete configuration used in the prj.conf file. However, I do not see any UART device on the host (for example, /dev/ttyACM*). Am I missing anything?”

    Environment:

    • Host OS: Yocto-based Linux v6.6-scarthgap

    • Bluetooth stack: BlueZ v5.72

    Settings:
    CONFIG_CONSOLE=n
    CONFIG_STDOUT_CONSOLE=n
    CONFIG_UART_CONSOLE=n
    CONFIG_GPIO=y
    #CONFIG_SERIAL=y
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_BT=y
    CONFIG_BT_HCI_RAW=y
    CONFIG_BT_HCI_RAW_H4=y
    CONFIG_BT_HCI_RAW_H4_ENABLE=y
    CONFIG_BT_BUF_ACL_RX_SIZE=255
    CONFIG_BT_BUF_CMD_TX_SIZE=255
    CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=255
    CONFIG_BT_CTLR_ASSERT_HANDLER=y
    CONFIG_BT_MAX_CONN=16
    #CONFIG_BT_CTLR_DTM_HCI=y
    CONFIG_CDC_ACM_SERIAL_PRODUCT_STRING="Zephyr HCI UART sample"
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    I see the following log with RTT Viewer.
  • Hi,

    As a first step, make sure to only follow the description:
    https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/samples/bluetooth/hci_uart/README.html#using_a_usb_cdc_acm_uart  

    Looks like it resets, like due to an assert. Try to enable the following for more information about the assert:

    CONFIG_ASSERT=y
    CONFIG_ASSERT_VERBOSE=y
    CONFIG_ASSERT_NO_COND_INFO=n
    CONFIG_ASSERT_NO_MSG_INFO=n
    CONFIG_RESET_ON_FATAL_ERROR=n

    Best regards,
    Kenneth

Related