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

Problem with nRF Connect for Android

Hello,

I'm working on a custom GATT service which has only one characteristic that support notification. The code has started from the ble_hrm service and it runs on a thingy (in parallel with all the other services the original thingy firmware has). With respect to the standard thingy firmware, in my application it is the thingy that connects as Central and the smartphone that acts as Peripheral.

When I enable the notification, the device start sending data, sd_ble_gatts_hvx returns NRF_SUCCESS and I get BLE_GATTS_EVT_HVN_TX_COMPLETE anyway on nRF Connect for Android (v 4.19.1) I cannot see the notification arriving. The strange thing is that, with an older version of nRF Connect for Android it worked and also with the desktop version it works. Moreover by porting the code to run on a PCA10040 again it works.

I have the impression that the nRF Connect somehow have problem when an unknown custom service is added to the Thingy GATT server.

Is this an expected behavior?

Thank you Davide.

  • Hi Davide, 

     

    A sniffer trace would verify if the notifications are actually sent over the air. 

    When you mentioned porting the code to PCA10040, did you port the whole ATT table of the thingy ?

    Have you tried with just one service and characteristic that you create (without the thingy's services)?

     

     

     

  • On the PCA10040 I just implemented my service, not the whole gatt server of the thingy.

    I didn't try the Thingy with just one service, anyway it works with all services on nRF Connect for Windows. I think the error cannot be on the Thingy side, otherwise it wouldn't work on windows.

    I'm quite sure the notifications are sent, because on an older version of nRF Connect for Android and on the last version of nRF Connect for windows everything works as expected. Notification are sent without any error and shown on the remote device.

    Starting from this condition, if I open nRF Connect for Android (last version 4.19.1) it connects and it finds the charactersitic. When I write the CCCD I see in the log screen that the write operation reach the thingy device that starts sending notification. They are sent with no error on the nRF52832, but nothing is shown in nRF Connect.

  • Hi,

    In some of the latest releases of nRF Connect for Android I decided to call `setCharacteristicNotification(..., true)` just after connecting to a device, so that if a notification is received from a device I would display the received value and marked the CCCD as enabled for this characteristic. This is because, when you debug your connection in background, while having another app open, you'd like to see the incoming notifications without need to  enable notifications (as they are already enabled by the other app). The intentions were amazing Slight smile

    However, as I found later, there is a limit of 15 characteristics per BluetoothGatt object that may have notifications enabled: Max 15 notifications . They are enabled from top to bottom, so if Thingy has already 15 characteristics with notify/indicate properties, calling this `setCharacteristicNotification` for 16th time does not work. That's may be the reason that you don't receive notifications.

    And actually, I made it so smart, that you can't disable them. You may send value to CCCD, but this does not disable the local listener. so.. there is no way to receive notifications from 16th+ characteristic. I'll fix it in the next release. For devices having less than 15 characteristics it will work like in 4.19.1, but for devices with higher number it will not enable them by default.

    I hope that's the reason. Otherwise I have no clue Slight smile

  • For now, you may use one of the oldest versions of nRF Connect for Android.

    You'll find them here: https://github.com/NordicSemiconductor/Android-nRF-Connect/releases

    Sorry for this!

  • It is very likely that you figured out the point. I tried to change the order of services inside the att table so that my custom service is now at the beginning and no more at the end. Now it receives notifications even in the version 4.19.1.

    Thank you Aleksander.

Related