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

BLE disconnect & adv_stop

Hi,

I have some problems with functions sd_ble_gap_disconnect and sd_ble_gap_adv_stop.

I got critical error when i try to disconnect or stop_adv and my phone is connected with my board.

code :

void advertising_stop(void){
	uint32_t err_code;
	err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
	APP_ERROR_CHECK(err_code);
	err_code = sd_ble_gap_adv_stop();
	APP_ERROR_CHECK(err_code);
}

I tried to disconnect only with :

void advertising_stop(void){
	uint32_t err_code;
	err_code = sd_ble_gap_adv_stop();
	APP_ERROR_CHECK(err_code);
}

But when i'm connected to my phone, the software of the board bug (critical error).

When my phone is not connected to my board, all is right, my board stop advertising.

Regards

Parents
  • So which one of those err_codes is non-zero? Probably the one you get from sd_ble_gap_adv_stop() is non-zero which then triggers the APP_ERROR_CHECK().

    So look at the value you're getting for err_code, and look it up under the sd_ble_gap_adv_stop() function documentation to find out what you're doing wrong.

    Hint: if you are in connection you already stopped advertising, so you can't stop it again.

Reply
  • So which one of those err_codes is non-zero? Probably the one you get from sd_ble_gap_adv_stop() is non-zero which then triggers the APP_ERROR_CHECK().

    So look at the value you're getting for err_code, and look it up under the sd_ble_gap_adv_stop() function documentation to find out what you're doing wrong.

    Hint: if you are in connection you already stopped advertising, so you can't stop it again.

Children
No Data
Related