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.

LAUNCHXL-CC26X2R1: basic ble example application; central role; gatt read error

Part Number: LAUNCHXL-CC26X2R1

Hi,

I am using the basic ble example application on a CC26X2R1 Launchpad. I cofigured it to act in central role.

I managed to connect to the desired device.

I created the following function to read GATT characteristics:

But it doesn't return "SUCCESS". It always returns the error code 0x16 (blePending). 

can anyone tell me what my mistake is?

kind regards 

Hannes

  • Hi Hannes,

    Can you share how you are calling the BleAppUtil_gattRead() function? I would like to see the context in which it is called in case that may be a factor here. Instead of calling the BLEAppUtil_getSelfEntity() earlier. Could you call it within the parameters? Something along these lines:

        status = GATT_ReadCharValue(connHandle, &req, BLEAppUtil_getSelfEntity());

    I would also ensure that the handle passed to the req variable is correct.

    Best Regards,

    Jan

  • Thanks for your Answer!

    I am calling the BleAppUtil_gattRead() function within the event handler in app_pairing.c, when the event BLEAPPUTIL_PAIRING_STATE_BOND_SAVED occured (see picture below). I can imagine that this might be the problem but I didn't know where else to call it.

    regarding your other suggestions:

    I am sure that the handle passed to the req variable is correct, because it worked in a different programm before. I also tried calling BLEAppUtil_getSelfEntity() within the parameters as you recommended, but it didn't change anything.

  • Hi,

    No problem! Understood, thank you for the details. Could you try calling gattRead function using the BLEAppUtil_invokeFunctions() methods?

    These functions can be found in the BLEAppUtil_init.c file.

    Best Regards,

    Jan

  • I tried using the invokeFunction methods but it didn't change anything. Calling GATT_readCharValue will still return the error code 0x16

  • Hi Hannes,

    We have released a GATT Client example on our ble_examples repo that implements GATT reads and GATT writes (alogn with notifications. Can you take a look at the example and see if it implements the desired functionality?

    Best Regards,

    Jan 

  • It seems that it generally does. But in the documentation it says, that connecting to a GATT device which doesn't match the basic_ble_GATT_client Table will lead to errors. But i want to connect to a custom BLE device.

  • Hi Hannes,

    That is correct, by default the example will connect to another device that has the basic ble service. That said, you can use the code as a reference to see what is needed to be implemented on your side. I would recommend referencing the various GATT functions (GATT API Guide) as these provide means to identify which services a connected device has as well as which characteristics. It also allows you to find where in the GATT table a specific characteristic resides which can be used with the previously provided code to interact with a peers characteristics.

    Best Regards,

    Jan