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

Ble Service Characteristic - Different Properties On Different Phones

Hi All,

We have a product based on nrf52832 that has a custom ble service with 2 custom characteristics.The first one is to send data to the nrf device and the second one receives the data back from nrf device using indications. So far this has been working rock solid, but lately we have noticed something weird.

On some phones we see the right characteristic property for characteristic 2 (READ, INDICATE)

But on some phones, we see a completely different set of properties for the same characteristic

From what we have noticed so far, the incorrect behaviour is being shown on the newer phones that support ble 5.

Any idea what could be going on here?

Thanks !

Parents Reply Children
  • Hi Amanda,

    Yes. It's the same hardware. We change the device name after provisioning. The screenshots were taken before and after provisioning on the same hardware, that's why the different name.

    We managed to the cause of the issue.

    In our code, we set the characteristics property notify value to 1, as seen in the code section below

    ble_gatts_char_md_t char_metadata;
    
    uint8_t initial_characterstic_value2[BLE_CUSTOM_CHARACTERSTIC2_SIZE] = {0};
    char* char2_desc = malloc(BLE_CUSTOM_CHARACTERSTIC_DESC_MAX_SIZE);
    char_metadata.char_props.write_wo_resp = 0;
    char_metadata.char_props.write = 0;
    char_metadata.char_props.read = 1;
    char_metadata.char_props.indicate = 1;

    adding the line

    char_metadata.char_props.notify = 0;

    solved the issue.

    Now that I think about it, since the variable is a local one, it would be initialized with a garbage value. So the .notify property could be some random value. Why this would work all this while with ble 4 phones and not with newer phones (with ble 5 support) is something of a mystery. Explicitly setting this field to 0 solves the issue.

    I checked Nordic official examples, and there also only the required fields are being set (and no memset 0 done on this local variable)

  • Hi Ankit, 

    Great to hear the success and the sharing. Slight smile

    -Amanda H.

Related