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.

CC2745R10-Q1: Connection Monitor failed to obtain connection data

Part Number: CC2745R10-Q1

Tool/software:

Hi, Ti

*SDK version: 9.11.00.18 ,example: car_node

I'm currently debugging the Connection Monitor. After the Connection_ConnEventHandler received the BLEAPPUTIL_LINK_ESTABLISHED_EVENT, an attempt to retrieve connection data via CMS_GetConnData failed, returning error code 0x05(CM_INVALID_PARAMS).

static void Connection_ConnEventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData)
{
#ifdef FII_CM
  cmsConnDataParams_t cm_data;
  uint16_t cm_data_size;
  cmErrorCodes_e status;
#endif

  if (pMsgData != NULL)
  {
    switch (event)
    {
      case BLEAPPUTIL_LINK_ESTABLISHED_EVENT:
      {
        gapEstLinkReqEvent_t *pGapEstMsg = (gapEstLinkReqEvent_t *)pMsgData;

        // Add the connection to the connected device list
        Connection_addConnInfo(pGapEstMsg->connectionHandle, pGapEstMsg->devAddr);

        PHSCA_ESELOG_PRINTF("%s", "Conn status: Established\r\n");

#if defined(RANGING_CLIENT) && !defined(RANGING_CLIENT_EXTCTRL_APP)
        // Call MTU exchange
        AppGATT_exchangeMTU(pGapEstMsg->connectionHandle, MAX_PDU_SIZE);
#endif
        BLEAppUtil_registerConnNotifHandler(pGapEstMsg->connectionHandle,GAP_CB_CONN_EVENT_ALL);

#ifdef FII_CM
        status = CMS_InitConnDataParams(&cm_data);
        if(status == CM_SUCCESS)
        {
            cm_data_size = CMS_GetConnDataSize();
            status = CMS_GetConnData(pGapEstMsg->connectionHandle, &cm_data);
            if(status == CM_SUCCESS)
            {
                PHSCA_ESELOG_PRINTF("CMS_GetConnData success! Data size[0x%4x]\r\n", cm_data_size);
            }
            else
            {
                PHSCA_ESELOG_PRINTF("CMS_GetConnData fail![0x%2x]\r\n", status);
            }
        }
        else
        {
            PHSCA_ESELOG_PRINTF("%s\r\n", "CMS_InitConnDataParams fail!");
        }
#endif

        break;
      }
}

log:

Is my workflow correct? Why did it fail?

Best regards!

Preston

  • Hello,

    It appears that you need to allocate a buffer inside of the cm_params structure:

    /**
     * @brief Host Connection Monitor Serving get connection data parameters
     */
    typedef struct
    {
      uint16_t dataSize;             //!< The allocated CM data size
      uint8_t  *pCmData;             //!< Pointer to the buffer the application allocated
    } cmsConnDataParams_t;

    So in your code:

            status = CMS_InitConnDataParams(&cm_data);
            if(status == CM_SUCCESS)
            {
                cm_data_size = CMS_GetConnDataSize();
                cm_data.dataSize = cm_data_size; // Add this
                cm_data.pCmData = ICall_malloc(cm_data_size); // Add this as well.
                status = CMS_GetConnData(pGapEstMsg->connectionHandle, &cm_data);
                if(status == CM_SUCCESS)

    Please let me know if this works for you!

    Best,

    Nima Behmanesh

  • Hi, Nima

    Issue resolved. Thank you for your support!

    Best regards!

    Preston