ble connection stuck

Hi, I've experienced an error in which a peripheral connects but can not send any data. I have these logs:
[1672131059] <err> bt_ctlr_hci: Tx Buffer Overflow
[1672131059] <wrn> bt_hci_core: Data buffer overflow (link type 0x01)
[1672131059] <err> bt_conn: Unable to send to driver (err -105)

How can I detect these error in my app?
bt_gatt_notify(...) returns with no error code

  • Can you please give me a bit more info on the context of this error?

    What was the state of the application before this error happened? Which SDK version?
    Can you show the call stack frame? Do you suspect any stack overflows?

  • some more details:
    - using zephyr, ncs 1.9.2
    - device is nrf52840
    - the error occurs after the peripheral has connected and tries to send a packet.
    - the application is not stuck

    - ble connection interval is 7.5[msec], connection latency is 0, and timeout is 4[sec]

    regarding stack size - how can I check if I am closed to limitations?

    I don't have access to the call stack frame because this bug happens very rarely and randomly, but it is a fatal bug which practically causes bricking of the device because it loses its ability to communicate. 

    - some configs that might be relevant

    CONFIG_BT_HCI_TX_STACK_SIZE=640
    CONFIG_BT_RX_STACK_SIZE=2200
    CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_BUF_ACL_TX_COUNT=3
    CONFIG_BT_BUF_CMD_TX_SIZE=65
    CONFIG_BT_BUF_CMD_TX_COUNT=2
    CONFIG_BT_HCI_TX_PRIO=7
    CONFIG_BT_CONN_TX_MAX=3
    CONFIG_BT_L2CAP_TX_BUF_COUNT=3
    CONFIG_BT_L2CAP_TX_FRAG_COUNT=2
    CONFIG_BT_L2CAP_TX_MTU=252
    CONFIG_RTT_TX_RETRY_CNT=2
    CONFIG_RTT_TX_RETRY_DELAY_MS=2



  • For checking if this is a stack overflow try adding these to the proj.conf

    CONFIG_THREAD_ANALYZER=y
    CONFIG_THREAD_NAME=y
    CONFIG_STACK_SENTINEL=y

    Also try to increase the tx buffer depth and size

    CONFIG_BT_CTLR_TX_BUFFERS=6
    CONFIG_BT_CTLR_TX_BUFFER_SIZE=251
    CONFIG_BT_L2CAP_TX_BUF_COUNT=6

    This seems to match the description of this issue. 

    Can you check if you have the same issue if you are using zephyr controller by adding this in your config

    CONFIG_BT_LL_SW_SPLIT=y

  • thanks! I will try it all of that.
    is there a way to know in the app level if "tx buffer overflow" has occurred so I can reset the MCU? 

    I check return code from bt_gatt_notify(), but it returns 0

  • If bt_gatt_notify returns 0 then it successfully got a free TX buffer locked to be sent. It does not seem to me that your app is doing anything wrong apart from the suspicion of either a stack memory corruption or a bug in the BLE controller. 

Related