This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BLE Packet Loss when using Android App

Other Parts Discussed in Thread: CC2541, CC2540

Hi,

I am working on a hardware device which sends a continuous stream of data over BLE to an Android App. The android app receives this data as GATT notifications, then processes this data and saves it to a database. 

The configuration details of the project are as follows:

1. Phone - Moto E 1st Generation

2. Android Version - Android 5.1 - Lollipop 

3. iOS - iPhone 4 & 5, tested on iOS 7 & 8 

3. Hardware - CC2541

4. Connection_Interval : 40 ms (Set in the firmware of the hardware).

5. Packets Sent Per Connection Interval : 4 (Set in the firmware of the hardware).

THE PROBLEM

When data is transmitted from the hardware device to the BLE data capture app running on Android phone, all the data packets are not received. It receives only about 35-45 packets, whereas the expected number of packets is 50. 

What is more surprising is that when we used the BLE packet sniffer, there was a perfect match between the data sniffed and displayed by the Android phone (which is incomplete / incorrect data). This leads me to believe that the hardware is behaving differently when connecting to the Android phone and not sending all of the data.

When we use the same hardware with an  iOS BLE data capture app, the data is received correctly.

I am puzzled and clueless about this behaviour of BLE data capture in Android. How the app on iOS device is able to capture all the data correctly whereas app on android phone is not able to capture data properly at all? 

Has anyone experienced such a problem of packet loss / incorrect data when using BLE app on Android?  Any inputs are welcome. Thank you so much for your help in advance.

The android App is using the standard BLE code (as given on Android Developer website)  to connect to the device over BLE.

  • Hi Aparna,

    I have notified our SensorTag and App team about this.

    Cheers,
    Fredrik
  • Not having worked with Android BLE since 4.3 I can give any authoritative answer, but I find it hard to believe that the Central device influences the way the SensorTag reports data via notifications. This is a non-handshake exchange so you expect the same behaviour. That said there is no guarantee that the connection parameters are identical, and these could influence the behaviour of the SensorTag. Also note that you can manipulate the connection parameters via the Connection Control service, thus overriding the Central Device's settings. Some Android phones (Samsung S3) drop the connection when you do this, but others don't and accept the new settings. In my experience the behaviour of the BLE stack also varied between Android devices.

    - Have you tried the same data collection scenario another Android device?
    - Have you tried with CC2540 USB dongle and BLE Device Monitor?
    - How many notifications do you send per seconds?
  • In addition to Jomar's suggestions, please also check the return status of your notifications to check there are available buffers for it.

    The central side typically will not use the FW desired connection interval and set its own (on iOS and Android at least) and for Android that interval is longer than for iOS.

    I would suggest flashing your CC2540 dongle with the HostTest hex file and use BTool to connect to your device to easily modify connection interval. This way you can see whether the connection interval affects the performance.

    Regards;
    Svend