Peripheral missing disconnect on timeout

When communication fails on NRF connectivity dongle (In Python via pc_ble_driver) and Error code: NRF_ERROR_BUSY is received on attempts to write and one restarts python script, a timeout appears to occur in peripheral. the connection changes state (after delay) from BT_CONN_CONNECTED to BT_CONN_DISCONNECT_COMPLETE.

This does not trigger a callback and application thus does not know to call bt_conn_unref() thus advertising is not resumed.

System runs Zephyr on nRF Connect SDK 1.8.0 as peripheral only.

Parents Reply
  • I have not yet managed to grab a sniff, but I did discover some issue related to this.
    The code uses NUS and so there is a callback registered with NUS for send, and as we allocate buffers and deliver to NUS we are not able to free them as link goes down.

    bt_gatt_notify_cb() is called by NUS in bt_nus_send() and it gives it (in param structure) a single callback for when it is complete. As long as link is alive when it starts this function, it does not fail, and queues up the data. However, there is no callback for failure if link goes down and there is now nobody to deliver the tx events to. Next connection is established, but nothing can be sent, and when this new connection times out (4 seconds default is a long time) nothing happens.

Children
No Data
Related