This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problems with nRFDK not disconnecting from iPhone running nRF Connect App

I'm playing around with the \v1.9.1\nrf\samples\bluetooth\peripheral_cts_client example on my nRFDK, and trying to implement something similar in my own code.  I'm running Zephyr/VSC with the nRF Connect add-in.

What I notice is that once I have connected to my DK, it never seems to let go of the connection, even when I send it a disconnect request from the nRF Connect App (runnign this on my iPhone).  The only way I can get it to disconnect is to turn off Bluetooth on my iPhone.

I'm a bit of a novice with the Nordic stuff, so am assuming I'm missing something obvious.  But looking at the call back function for disconnection, and comparing this to the same callback function in other BLE examples, where the disconnect request from the App does in fact result in a disconnection, I can't see any differences.

Can anyone help me out here?

Cheers,

Mike

  • Had a bit more of a look into this over the weekend.  Seems there are plenty of references to this behaviour on the Nordic DevZone, but all are related to Android devices as the Central, not iOS devices.  And no-one appears to have provided a reason/solution, beyond forcing the disconnection from the Peripheral side.  Seems a bit counter-intuitive for a Peripheral to be severing the connection that a Central has requested though.

    So, I had a play around with that approach and putting in a call to:

    bt_conn_disconnect(cts_c->conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN);

    once the Peripheral had successfully grabbed the current time.  This appears to work.

    Seems like a cludgy work-around to me though.  Surely a Peripheral should respond to a disconnect request from a Central, regardless of whether they are bonded or not?

  • Hi Mike,

    Yes, the app itself doe not have access to disconnect Bluetooth Device, you need either go to Settings->Bluetooth->Forget this device on iOS system level or disconnect from periperial.

    Best regards,

    Charlie

  • Hi Charlie,

    Thanks for the confirmation.  It only seems to be an issue when the Central and Peripheral are bonded.  Why is that?

    If there is a non-bonded connection, the Central can issue the disconnect command and the Peripheral will acknowledge and disconnect.

    But if the connection is bonded, this doesn't occur.  Is this an intentional design feature for bonded connections?  Just trying to understand the "why" even though I've got a solution to the problem

    Cheers,

    Mike

  • Hi Mike,

    Again, I guess this is some limitation decided by the iOS or Android system. I do not have a better answer from the BLE peripheral perspective.

    Best regards,

    Charlie

  • If I use the nRF Connect for Desktop on my Windows machine, everything works as expected, and I can get the Peripheral to respond to a disconnect command from the Central when they are paired and bonded - which is the behaviour I would expect.

    Must be something about the App, or iOS devices that prevents this functionality, because I see it on both the nRF Connect App and the LightBlue App.  I'm using an iOS device, so not sure if the same behaviour occurs on an Android device

    Cheers,

    Mike

Related