I'm using nRF52DK with ble_app_hids_mouse to pair with the smartphone.
From the smartphone we can disconnect the device at will. But I have problem when I want the device to disconnect from the smartphone. At some point I want the device to disconnect and go to sleep with the following statements:
sd_ble_gap_adv_stop(m_advertising.adv_handle);sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);m_conn_handle = BLE_CONN_HANDLE_INVALID;sd_power_system_off();
When the above statements are executed, on the smartphone I can see it momentarily disconnected but then it reconnected again right after that. I wonder what am I missing here in order to have the device disconnect totally then go to sleep.
Was the debugger still connected? This would prevent going into system OFF mode.
It happened even when the debugger is not activated. The Keil compiler is not even running.
I used Push Button 4 to trigger the above statements.
I resolved the issue by removing the line: