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.

CCS/LAUNCHXL-CC2640R2: CC2640R2F can't trigger GAP_RANDOM_ADDR_CHANGED_EVENT

Part Number: LAUNCHXL-CC2640R2

Tool/software: Code Composer Studio

Hi Team,

SDK: 3.10  CCS version: CCS V9

Customer uses GAP_ConfigDeviceAddr to device address. Device address can be periodically change, but can't trigger GAP_RANDOM_ADDR_CHANGED_EVENT event. Please help explain and resolve it.

static void gapRole_processGAPMsg(gapEventHdr_t *pMsg)
{
uint8_t notify = FALSE; // State changed notify the app? (default no)

switch (pMsg->opcode)
{
case GAP_DEVICE_INIT_DONE_EVENT:
{
gapDeviceInitDoneEvent_t *pPkt = (gapDeviceInitDoneEvent_t *)pMsg;
bStatus_t stat = pPkt->hdr.status;

if (stat == SUCCESS)
{
// Save off the generated keys
VOID osal_snv_write(BLE_NVID_IRK, KEYLEN, gapRole_IRK);
VOID osal_snv_write(BLE_NVID_CSRK, KEYLEN, gapRole_SRK);

// Save off the information
VOID memcpy(gapRole_bdAddr, pPkt->devAddr, B_ADDR_LEN);

gapRole_state = GAPROLE_STARTED;


GAP_ConfigDeviceAddr(ADDRMODE_PRIVATE_RESOLVE, NULL);

GAP_SetParamValue(TGAP_PRIVATE_ADDR_INT, 1);

// Update the advertising data
stat = GAP_UpdateAdvertisingData(selfEntity,
TRUE, gapRole_AdvertDataLen, gapRole_AdvertData);
}

...
 case: GAP_RANDOM_ADDR_CHANGED_EVENT: 
{

}

  • Hi Alvin,
    Assigning this to one of the experts.
  • other question:

    Central scan this peripheral in first , scan result address show RPA.  peripheral address will be update  in Central connected list when connected and pairing &bonding success .

     else if (state == GAPBOND_PAIRING_STATE_COMPLETE)
      {
        if (status == SUCCESS)
        {
          linkDBInfo_t linkInfo;
    
          Display_printf(dispHandle, SC_ROW_CUR_CONN, 0, "Pairing success");
    
          if (linkDB_GetInfo(pPairData->connHandle, &linkInfo) == SUCCESS)
          {
            // If the peer was using private address, update with ID address
            if ((linkInfo.addrType == ADDRTYPE_PUBLIC_ID ||
                 linkInfo.addrType == ADDRTYPE_RANDOM_ID) &&
                 !Util_isBufSet(linkInfo.addrPriv, 0, B_ADDR_LEN))
            {
              // Update the address of the peer to the ID address
              Display_printf(dispHandle, SC_ROW_NON_CONN, 0, "Addr updated: %s",
                             Util_convertBdAddr2Str(linkInfo.addr));
    
              // Update the connection list with the ID address
              uint8_t i = SimpleCentral_getConnIndex(pPairData->connHandle);
    
              SIMPLECENTRAL_ASSERT(i < MAX_NUM_BLE_CONNS);
              memcpy(connList[i].addr, linkInfo.addr, B_ADDR_LEN);

    Central rescan this peripheral when terminate connection. Central scan result  address will show this peripheral primary BLE Address.  Why scan result address don't show RPA, please explain it.

  • Hi Joakim,

    Any update on this post?
  • Hi Alvin,

    1) Can you check the return status of GAP_ConfigDeviceAddr()?
    2) Where are you looking for GAP_RANDOM_ADDR_CHANGED_EVENT? Can you please check in the GAPRole event queue (peripheral.c/central.c)?

    If the devices are bonded the central will automatically resolve the peripheral's random address and get the identity address.
  • Hi Marie,

    1. return status of GAP_ConfigDeviceAddr() is SUCCESS.

    2.peripheral.c

    static void gapRole_processGAPMsg(gapEventHdr_t *pMsg)
    {
      uint8_t notify = FALSE;   // State changed notify the app? (default no)
    
      switch (pMsg->opcode)
      {
        case GAP_DEVICE_INIT_DONE_EVENT:
          {
            gapDeviceInitDoneEvent_t *pPkt = (gapDeviceInitDoneEvent_t *)pMsg;
            bStatus_t stat = pPkt->hdr.status;
    
            if (stat == SUCCESS)
            {
              // Save off the generated keys
              VOID osal_snv_write(BLE_NVID_IRK, KEYLEN, gapRole_IRK);
              VOID osal_snv_write(BLE_NVID_CSRK, KEYLEN, gapRole_SRK);
    
              // Save off the information
              VOID memcpy(gapRole_bdAddr, pPkt->devAddr, B_ADDR_LEN);
    
              gapRole_state = GAPROLE_STARTED;
    
              stat = GAP_ConfigDeviceAddr(ADDRMODE_PRIVATE_RESOLVE, NULL);
    
              if (stat != SUCCESS)
              {
                  System_abort("Error!");
              }
    
              //Set timeout value to 5 minute
              GAP_SetParamValue( TGAP_PRIVATE_ADDR_INT , 5);
              // Update the advertising data
              stat = GAP_UpdateAdvertisingData(selfEntity,
                                  TRUE, gapRole_AdvertDataLen, gapRole_AdvertData);
            }
    
            if (stat != SUCCESS)
            {
              gapRole_state = GAPROLE_ERROR;
            }
    
            notify = TRUE;
          }
          break;
        case GAP_RANDOM_ADDR_CHANGED_EVENT:
         {
    
    
         }
         break;

  • Hi Alvin,

    This seems to be a documentation issue. The GAP_RANDOM_ADDR_CHANGED_EVENT is not generated when using Bluetooth 4.2 Privacy (which you are). I am sorry about the confusion.

  • Hi Marie,

    Thanks for your confirm.