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.

LP-CC2651R3SIPA: CC2651R3SIPA: Characteristic Value Length

Part Number: LP-CC2651R3SIPA
Other Parts Discussed in Thread: CC2651R3SIPA

Hello,

I'm using the simple_peripheral_LP_CC2651R3SIPA_tirtos7_ticlang as a startup project. everything works fine until i change the Characteristic Value Length to be > 22 bytes.

the original code (works fine: IMPLEPROFILE_CHAR5_LEN  = 5,  which is < 22)

// Length of Characteristic 5 in bytes
#define SIMPLEPROFILE_CHAR5_LEN           5

// Simple Profile Characteristic 5 Properties
static uint8 simpleProfileChar5Props = GATT_PROP_READ;

// Characteristic 5 Value
static uint8 simpleProfileChar5[SIMPLEPROFILE_CHAR5_LEN] = { 0, 0, 0, 0, 0 };

// Simple Profile Characteristic 5 User Description
static uint8 simpleProfileChar5UserDesp[17] = "Characteristic 5";

the modified code (crashes:  SIMPLEPROFILE_CHAR5_LEN  = 23,  which is > 22)

// Length of Characteristic 5 in bytes
#define SIMPLEPROFILE_CHAR5_LEN           23

// Simple Profile Characteristic 5 Properties
static uint8 simpleProfileChar5Props = GATT_PROP_READ;

// Characteristic 5 Value
static uint8 simpleProfileChar5[SIMPLEPROFILE_CHAR5_LEN] = { 0, 0, 0, 0, 0 };

// Simple Profile Characteristic 5 User Description
static uint8 simpleProfileChar5UserDesp[17] = "Characteristic 5";

any idea where that limit is defined and how to increase it at least to 64 bytes?

Thank you in advance!

  • Hello Simbasoft,

    Thanks for reaching out.

    Could you please share more details about the issue you are having when crashing (CCS error/warning logs)?

    My guess is that the issue is in the initialization of the simpleProfileChar5 array. Size (23) does not matches the number of initialized elements.

    static uint8 simpleProfileChar5[SIMPLEPROFILE_CHAR5_LEN] = { 0, 0, 0, 0, 0 };

    BR,

    David.

  • Thank you, David!

    No, the initialization is not the issue: Initializing the array to a number of elements that is less that or equal to 23 elements (i.e., 5 < 23) - and it is NOT a compilation error.

    crashing means, the system faults (stops running). the issue is either a timeout, OR characteristics value length limitation defined somewhere int the SDK/BLE Stack. 

    SDK: simplelink_cc13xx_cc26xx_sdk_7_10_00_98

    crashing at run time on line 629, in this function- see the image below.

    bStatus_t simpleProfile_ReadAttrCB(uint16_t connHandle,
                                        gattAttribute_t *pAttr,
                                        uint8_t *pValue, uint16_t *pLen,
                                        uint16_t offset, uint16_t maxLen,
                                        uint8_t method);

    the function is a callback function. whoever is calling the same function is not allocating sufficient memory "pAttr->pValue,"

    // Simple Profile Service Callbacks
    // Note: When an operation on a characteristic requires authorization and
    // pfnAuthorizeAttrCB is not defined for that characteristic's service, the
    // Stack will report a status of ATT_ERR_UNLIKELY to the client.  When an
    // operation on a characteristic requires authorization the Stack will call
    // pfnAuthorizeAttrCB to check a client's authorization prior to calling
    // pfnReadAttrCB or pfnWriteAttrCB, so no checks for authorization need to be
    // made within these functions.
    CONST gattServiceCBs_t simpleProfileCBs =
    {
      simpleProfile_ReadAttrCB,  // Read callback function pointer
      simpleProfile_WriteAttrCB, // Write callback function pointer
      NULL                       // Authorization callback function pointer
    };
    

  • Hello Simbasoft,

    Just for sanity check could you please try initializing the array with all the elements?

    Also, what is the MAX_PDU_SIZE in your project?

    Are you using the Simple Connect App or another device as central? Characteristic #5 is used for bonding purposes (passing key).

    BR,

    David.

  • David, it works when SIMPLEPROFILE_CHAR5_LEN 22, and everything else is the same; still initialized the same way.

    There is a fundamental issue with the TI example code - this simpleProfile_ReadAttrCB function lacks the very basics of robustness.

    // Length of Characteristic 5 in bytes
    #define SIMPLEPROFILE_CHAR5_LEN           22
    
    // Simple Profile Characteristic 5 Properties
    static uint8 simpleProfileChar5Props = GATT_PROP_READ;
    
    // Characteristic 5 Value
    static uint8 simpleProfileChar5[SIMPLEPROFILE_CHAR5_LEN] = { 0, 0, 0, 0, 0 };
    
    // Simple Profile Characteristic 5 User Description
    static uint8 simpleProfileChar5UserDesp[17] = "Characteristic 5";

  • Hello Simbasoft,

    I reproduced the changes on a similar board and I do not have the same issue. I will work on reproducing it on the same board as yours. However I wanted to ask you if you could confirm that the only thing you modified in the project was the SIMPLEPROFILE_CHAR5_LEN and what is the MAX_PDU_SIZE.

    Could you please try flashing the following .hex file and checking if the same issue occurs?

    simple_peripheral_LP_CC2651R3SIPA_tirtos7_ticlang.hex

    BR,

    David.

  • I have already tried increasing the PDU size did not help.

    the hex is not good for me. please send the the complete project source code and the version of DSK associated with it.

    For now, I'm working on getting our roject work with the 22 bytes restriction. I will get back to to this issue in a week or two.

  • Hi David,

    I made our application work with the 22 bytes restrictions and have no intention to figure out the reason for such limitation.

    You may close this issue - and thank you very much for your help.

    Regards.