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

gattc read in multi connect

I am using S120 Softdevice, with bunch of different type ble tags(peripherals). written a code to connect multiple tags at a time and doing a gattc read to fetch the battery level.

Each type of tag has different read handles for battery read.

I am getting invalid battery levels.

Verified with gatt tool & nrfconnect on each tag type and came to conclusion that read request are not going to specific tag. i.e after connecting to multiple tags doing a gattc read request to multiple tags are getting misplaced. I verified that i am sending appropriate read handle for sd_ble_gattc_read after connect event.

Is there issue with multi connect.

  • Are you using the BLE battery service for this? Yes. So none of the tags really have 2 %, 8% battery level?
    Yes, Verified with nrfconnect Mobile App & gatttool. As i said i got TagA read handle(0x09) and TagB read handle(0x12), with gatt tool i tried to do a char-read on TagA with 0x12 and TagB with 0x09 i am getting 2%,8% battery read values.

    How are you measuring the battery level? Are you using the ADC for this? Yes.

    When does this bug happen? Only when you are reading different tags at once?.

    Yes, This bug will occur when i initiate connect to multiple tags at time. Yes i am doing a read on different tags. When i place One tag,/two Tags of each type this bug was not reproduced as my application will connect one tag will do a battery read disconnect and connect to other tag. If large number of tags are there (i.e 15/20/40) my application will try to connect to multiple tags and getting 2%,8% battery reads once in every 5 times.

  • How do you know that read request are going to other(wrong) tags ?

    Are you sure it's not an issue with the ADC readings?

    nRF51x22 Evaluation Kit(PCA10001) uses an nRF51 IC revision 1 or 2. This is an outdated chip revision, and not recommended for new products and design(nRF51 IC is now on revision 3). Also this old SDK could have some bugs. So it's not unthinkable that these factors could somehow be causing the issue. As mentioned in your other post, I would therefore recommend upgrading to a Development Kit. For new products I would recommend a nRF52832-DK, where you have support for the latest SDK versions and Bluetooth 5.

  • My Bad its a synchronization issue with my code, This was causing read requests going to other connected tags.

  • Ok. Glad to hear that you found the issue :)

Related