Android app disconnects when from device receiving notifications from multiple devices

Hello everyone,

I am currently developing an Android app, where I have 2 BLE custom boards with the nRF52832 as a BLE chip. Each board has the same firmware running on it and is configured to send notification of 20 bytes in a 50Hz frequency. I am using the the Nordic BLE library to connect and communicate with the devices.

The connection to both devices works without any issues. Initially the phone is receiving data from both sensors but after a short time (between 1 - 5 seconds) the phone disconnects itself from one sensor. The Logcat for the app doe not provide any useful information either. The only thing i can see there is, that the device has been disconnected (only onConnectionUpdated is shown. No disconnect request).

Connecting the same devices with the equivalent iOS app does work. So I assume the error has to be in some way, how I handle it on Android.

If you need any additional information please let me know.

Thank you all in advance.

Parents Reply
  • Correct, there should be two devices. But i did not manage to get Wireshark to catch the packets form both devices. I can either get the advertisement from both or only the notification from a single one.

    About the error packets. I have no idea why this is there. I have checked with the iOS app as well and it seems those are not happening there.

Children
  • Hm I thought it should be possible to see all the packets, that would give a clearer picture of what is happening.

    But even with just this log it seems like there is an update in connection parameters that causes this.

    You can inspect the contents of the packets in wireshark to investigate what specifically is happening.

    I would suggest having a look at the parameters in the LL_CONNECTION_UPDATE_IND packet, perhaps if you set the parameters to something like these values from the start you can avoid this update event.

    -Einar

  • So I've done some more testing.
    So far those are my findings:

    - The connection being disconnected always on the second device that is connected to the phone. So the connection order matters.

    - Both peripherals get the same LL_CONNECTION_UPDATE_IND. The connection parameters are the same as for both peripherals.

    I also do not think that this might have something to do with the LL_CONNECTION_UPDATE_IND since running the app with only one peripheral, the connection is stable. The connection is also stable with the peripheral that was first connected to the phone.

    Never the less I have set the connection parameters (Connection priority on Android) to high. Since there are only 3 options that can be set on Android. Sadly this also did not help.

    Is there anything else i can try?

  • Hi

    You say you've set connection parameters on your Android phone.

    Have you tried adjusting the preferred parameters of your peripheral?

    -Einar

  • Sadly this is not possible for me at a current stage since i don't have the rights to update the peripheral firmware.

    Additionally last weekend I tested the same app on a different phone (Fairphone 4). There the connection to both peripherals was maintained without any issues. So I have the assumption, that the limit could be the usage of the Bluetooth chip version. On the Nokia it is Bluetooth 4.2 while on the Fairphone and iPhone it is 5.0. I'm not sure though, if this indeed could be the source of the issue or there might be some other reason.

    Maybe you know a bit more about this Einar.

  • J.R. said:
    i don't have the rights to update the peripheral firmware.

    That's unfortunate, as it will limit what you're able to test.

    J.R. said:
    On the Nokia it is Bluetooth 4.2 while on the Fairphone and iPhone it is 5.0

    As far as I know there shouldn't be any difference between 4.2 and 5.0 in regards to number of connections, but what might be limited in 4.2 is connection speed. So it could be that your peripheral requests a higher speed and is rejected by the central.

    It could also be possible that the phone has a faulty or incomplete implementation of the BLE stack, in which case you would have to contact Nokia about it, but I would want to make sure that it  isn't caused by the different Bluetooth version before taking that step.

    -Einar

Related