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

Nordic controller is not receveing the ble disconnect event from the ble android application som times if i kill the app?reproducability 1 out of 20.

I am using nrf52832 peripheral and ble central with some android application .if an app opens it we get ble disconnect event and if we kill the app ble_disconect will come to the nordic board.it is working normally in most cases.if we forcefully kill the application when app was getting opened for n number of times the nordic controller  some times not receiving the ble disconnect event and controller board is still in connected state.Now if i kill the app since nordic is in  connected state and the peripheral is not visible to the android application. The nordic is coming out of connection state only after bluetooth was turn off.(android is throwing ble disconnect event when disconnect but which is blocking its reach to nordic board or it is problem with nordic internal code)

Parents
  • When a device disconnect the link, there will be disconnect packet sent from the device to the peer, and the peer  will acknowledge this packet, now the link is considered disconnected on both sides of the link.

    If there is noise in the environment, the acknowledge from the peer may be lost, in such case only the peer will disconnect, while the device will remain in a connection until supervisor timeout occurs. This is according to Bluetooth spec.

  • android is not sending disconnect .here in this case i have verified with bluetooth snooping log

  • Hi Kenneth,I dont have a sniffer i need to buy that...

    from ble snooping log it is going through the fallowing sequence

    1.scanning

    2.connect

    3.paramers update

    4encryption

    5data exachange

    after central has sent connect nordic board leds is on and after that paramter updatation is done no if we kill the blue tooth application at encryption stage  in android (some times android is not sending ble disconnect and so is  nordic not getting disconnected) and no data tranfer was taking place.

    It is is connected state till we disable the bluetooth in the andorid.

     Q 1)at this stage why IN NORDIC  time out was not coming even if we are not exchanging any data and getting disconnected.

     Q 2)How to disconect the nordic if encryption was nor successfull and if it is there why it is not happening 

    i am not changing any thing in the device manager code

  • how can i delay the link encrption acknowledgement to the android during the connection establishment so that i can create a issue? 

  • You could try using high connection interval values, which would slow down everything.

  • Hi, you can always add an application timer that is started on connection event, and then the application timer can disconnect the link, if the link has not successfully encrypted after for instance a few seconds.

  • hi tank you  for the support,

    I have implemented the timer and it is working fine

    now my doubt is why time out is not coming if we are not exachanging any data for more than 4 sec? can u please explain?

Reply
  • hi tank you  for the support,

    I have implemented the timer and it is working fine

    now my doubt is why time out is not coming if we are not exachanging any data for more than 4 sec? can u please explain?

Children
  • First step would be to setup an app_timer that repeatedly toggle an GPIO, to verify you have implemented app_timer correctly, does this work? 

    Next step would be to start the app_timer on BLE_GAP_EVT_CONNECTED event, and then if there is no PM_EVT_CONN_SEC_SUCCEEDED in pm_evt_handler() within lets say 5seconds, then the app_timer timeout handler can execute sd_ble_gap_disconnect() to force a disconnect.

    You can stop the app_timer on PM_EVT_CONN_SEC_SUCCEEDED and BLE_GAP_EVT_DISCONNECTED events, to make sure the timeout handler does not execute a disconnect if the link is securely encrypted or if the link is already disconnected.