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.

CC2640R2F: How to get BLE Access Address from Peripheral after BLE connection established

Part Number: CC2640R2F

Hello BLE Apps team,

I have been testing few example codes (BLE 4.2 simple peripheral & simple_central) to use connection_monitor in BLE SDK v2.30.49.

As we already know, BLE access code is decided by Central Device. I expect that there is a way to get the access code on peripheral device if BLE connection has been established. However, HCI_EXT_GetActiveConnInfoCmd API only returned the access code as 0x00 in peripheral device.

I attached necessary code snippet (simple_peripheral) to reproduce this issue.

    case GAPROLE_CONNECTED:
      {
        linkDBInfo_t linkInfo;
        uint8_t numActive = 0;

        hciActiveConnInfo_t *pConnInfo;
        pConnInfo = ICall_malloc(sizeof(hciActiveConnInfo_t));

        if (pConnInfo != NULL)
        {
          // Get the connection info of a single connection
          HCI_EXT_GetActiveConnInfoCmd(0, pConnInfo);
          Display_print1(dispHandle, 10, 0, "AccessAddress: 0x%x", pConnInfo->accessAddr);
          Display_print1(dispHandle, 11, 0, "Connection Interval: %d", pConnInfo->connInterval);
          Display_print3(dispHandle, 12, 0, "HopVal: %d, nxtCh: %d, mSCA: %d",
                         pConnInfo->hopValue,
                         pConnInfo->nextChan,
                         pConnInfo->mSCA);
          Display_print5(dispHandle, 13, 0, "ChanMap: \"%x:%x:%x:%x:%x\"",
                         pConnInfo->chanMap[4],
                         pConnInfo->chanMap[3],
                         pConnInfo->chanMap[2],
                         pConnInfo->chanMap[1],
                         pConnInfo->chanMap[0]);

          ICall_free(pConnInfo);
        }
        else
        {
          Display_print0(dispHandle, 4, 0, "ERROR: Failed to allocate memory for return connection information");
        }
     
      }
      break;

  • Hi Richard,

    Are you sure you are using the correct connId? Can you use HCI_EXT_GetConnInfoCmd() to get it?

    I am not sure in what contexts the HCI_EXT_GetActiveConnInfoCmd () API is supported. I will check it and get back to you.
  • Hi Marie,

    There is no connection information that I need such as access address, connection interval, and etc in structure hciConnInfo_t 

    extern hciStatus_t HCI_EXT_GetConnInfoCmd( uint8         *numAllocConns,
                                               uint8         *numActiveConns,
                                               hciConnInfo_t *activeConnInfo );
    
    #if defined( CC26XX ) || defined( CC13XX )
    PACKED_TYPEDEF_STRUCT
    #else // CC254x
    typedef struct
    #endif // CC26XX/CC13XX
    {
      uint8 connId;                           //!< device connection handle
      uint8 role;                             //!< device connection role
      uint8 addr[LL_DEVICE_ADDR_LEN];         //!< peer device address
      uint8 addrType;                         //!< peer device address type
    } hciConnInfo_t; //!< Connection Info

    FYI, this is hciActiveConnInfo_t strcture.
    #if defined( CC26XX ) || defined( CC13XX )
    PACKED_TYPEDEF_STRUCT
    #else // CC254x
    typedef struct
    #endif // CC26XX/CC13XX
    {
      uint32_t  accessAddr;                          //! return error code if failed to get conn info
      uint16_t  connInterval;                        //! connection interval time, range (7.5ms, 4s), 625us increments
      uint8_t   hopValue;                            //! Hop value for conn alg 1, integer range (5,16), can also be used to tell if using alg 2 by sending special code not in normal hop range i.e. 0xff or 0x00.
      uint16_t  mSCA;                                //! master sleep clock accuracy code mapped based on BLE spec
      uint8_t   nextChan;                            //! next data channel
      uint8_t   chanMap[LL_NUM_BYTES_FOR_CHAN_MAP];  //! bitmap of used BLE channels
      uint32_t  crcInit;                             //! connection CRC initialization value (24 bits)  
    }hciActiveConnInfo_t;

    Best regards,
    Richard Park

  • Hi Richard,

    This seems to be an issue in the Simplelink CC2640R2 SDK 2.30. The bug is that HCI_EXT_GetConnInfoCmd() does not return anything if the GAP Role peripheral is chosen. Hopefully this will be fixed in the next Simplelink CC2640R2 SDK.
  • Hi Marie,

    I will contact via email. This issue must be cleared for commercial project.

    Best regards,
    Richard Park