This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

BLE - Try to disconnect during sending notification

Hello,

My config:
- nRF SDK v17.1.0
- nRF SoftDevice S140 7.2.0
- FreeRTOS Kernel v10.0.0 (Amazon.com)

My project used BLE connection with custom service (based on NUS). I am using nitifications for sendind custom data between my peripheral (server) device and central (client) device.

I have got issue when I disconnect BLE connection (disconnect triggered from peripheral or from central device) when notification are enabled.
When I want to make new connection one more time, connection is being established but app is being crashed in function sd_ble_gatts_hvx(0 (error x3401).

It looks like after disconnection, notifications are still being enabled and my custom service would like to send them after new connection is being established. I suppose it couse the issue. How can I disable notification on periheral device after disconnection?

My disconnection code:

/* Disconnect only when connection is established */
if (bleConnHandle != BLE_CONN_HANDLE_INVALID)
{
    errCode = sd_ble_gap_disconnect(bleConnHandle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
    APP_ERROR_CHECK(errCode);
} 

Related