This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

why ble_advertising_start()returns error code 18

Excuse me:

                    Project in nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\ble_app_hids_keyboard\pca10040e\s112\ses,After the device is connected, I call the sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION) to disconnect,Then call the  advertising_start(true)  to delete the binding,After the binding is deleted, the advertising_start(false) function is called to start advertise ,then return the error code 18.

Parents
  • Hi

    After you call sd_ble_gap_disconnect(..) you should wait for the BLE_GAP_EVT_DISCONNECTED event to be called, before continuing the operation of erasing bonds and restarting advertising. 

    Error 18 is the NRF_ERROR_CONN_COUNT error, which could indicate that you are trying to start advertising while the previous connection is not properly closed. 

    Best regards
    Torbjørn 

Reply
  • Hi

    After you call sd_ble_gap_disconnect(..) you should wait for the BLE_GAP_EVT_DISCONNECTED event to be called, before continuing the operation of erasing bonds and restarting advertising. 

    Error 18 is the NRF_ERROR_CONN_COUNT error, which could indicate that you are trying to start advertising while the previous connection is not properly closed. 

    Best regards
    Torbjørn 

Children
Related