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

error 0x3002

hi team,

         i was using nrf52840 with sd 5.0 and developed a custom application using ble_app_proximity in 14.1. my use case is my device should hand shake only with my mobile app. so made a code with time of 10 sec if i didnt enter the password after connecting to the device with in 10 sec the device will be automatically disconnected from the mobile app. the password is entered through the uart services.

i had tested the code in nrf connect app for android in below ways.

1. connected with device and disconnecting manually.

2 connected with device and not entering any password checking whether the disconnection happens after 10 sec automatically.

3. connected with device and entering wrong password checking whether the disconnection happens after 10 sec automatically.

4. connected with device and entering correct password checking whether connection remains for ever.

in above 4 cases. i am getting error in 1st case 0x3002, BLE_ERROR_INVALID_CONN_HANDLE, NRF_LOG_ERROR("SOFTDEVICE: ASSERTION FAILED"); .but all other 3 cases are working fine.

in the debug mode error falls in this line 

sd_ble_gap_disconnect.

static void password_timeout_handler(void * p_context)
	{    
		(void) p_context;
    if (is_waiting_for_password)
    {
        uint32_t err_code = sd_ble_gap_disconnect(m_conn_handle,BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
        APP_ERROR_CHECK(err_code);
    }
		//is_waiting_for_password = true;
}

what will be the problem how to resolve this. any solution is appreciable.

thanks and regards,

karthikeyan.

  • Hello Karthikeyan,

    Because you have already disconnected, the timeout handler that tries to disconnect with an m_conn_handle that has already been disconnected, and thus, probably already set to BLE_CONN_HANDLE_INVALID.

     

    Either, you have to stop the timer on the disconnection event, to prevent the softdevice from trying to disconnect from a connection that has already been disconnected, or you can ignore the err_code == BLE_ERROR_INVALID_CONN_HANDLE, because the task you want to perform has already been completed:

    uint32_t err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
    if (err_code != BLE_ERROR_INVALID_CONN_HANDLE)
    {
        APP_ERROR_CHECK(err_code);
    }

     

    Best regards,

    Edvin

  • hi edvin,

       thanks for your reply. i will check it and reply you soon.

    regards,

    karthikeyan.

Related