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: CC2640R2F can not scan other device(random address)

Part Number: CC2640R2F

Hi ,

I use nRF connect app to create an advertisement.

But this device cannot be scanned using cc2640r2f.(phone and PC can scan it)

What settings do I need to modify?

SDK:cc2640r2_sdk_1_40_00_45

Please refer to the following for scan code.

GAP_DEVICE_INFO_EVENT.txt
    case GAP_DEVICE_INFO_EVENT:
    {

#ifdef DEV_DISC_BY_SVC_UUID
      //if(str_cmp(addrBuf,pEvent->deviceInfo.addr,6)==1)
      //if(pEvent->deviceInfo.addrType==0x00)
      if(pEvent->deviceInfo.addrType==0x00 || 0x01 || 0x02 || 0x03)
      {
          //if ( simpleBLEFindSvcUuid( WANTED_SERVICE_UUID,
          //                           pEvent->deviceInfo.pEvtData,
          //                           pEvent->deviceInfo.dataLen ) )
          //{
            //simpleBLEAddDeviceInfo( pEvent->deviceInfo.addr, pEvent->deviceInfo.addrType );
            
            scanIndexID++;
            TLwrite(&pEvent->deviceInfo.addrType,1);
            SerialPrintString("\r\n");
            memcpy(addrBuf, pEvent->deviceInfo.addr, 6);
            memcpy(devList[scanIndexID-1].addr, pEvent->deviceInfo.addr, B_ADDR_LEN);
            devList[scanIndexID-1].rssi = pEvent->deviceInfo.rssi;
            devList[scanIndexID-1].addrType = pEvent->deviceInfo.addrType;
            // Convert address to string
            uint8_t *pAddr = (uint8_t*)Util_convertBdAddr2Str(pEvent->deviceInfo.addr);

            // Copy converted string to static device list
            memcpy(devList[scanIndexID-1].strAddr, pAddr, B_STR_ADDR_LEN);
            
          //}
      }
      else
      {
        
        if(pEvent->deviceInfo.eventType==0x04)
        {    
            devList[scanIndexID-1].eventType = pEvent->deviceInfo.eventType;
#ifndef TRANSPARENT               
            memcpy(devList[scanIndexID-1].advBuf, pEvent->deviceInfo.pEvtData, pEvent->deviceInfo.dataLen);  
#endif            
        }
        
        
      }  

Thanks.

  • Hello,

    I tried this out using SDK v1.50 (the oldest I had on hand at the moment). I was able to discover my iPhone 11 using both BTOOL and the simple_central example.

    I simplified the logic of the GAP_DEVICE_INFO_EVENT as follows:

        case GAP_DEVICE_INFO_EVENT:
          {
            // if filtering device discovery results based on service UUID
    //        if (DEFAULT_DEV_DISC_BY_SVC_UUID == TRUE)
    //        {
    //          if (SimpleBLECentral_findSvcUuid(SIMPLEPROFILE_SERV_UUID,
    //                                           pEvent->deviceInfo.pEvtData,
    //                                           pEvent->deviceInfo.dataLen))
    //          {
    //            SimpleBLECentral_addDeviceInfo(pEvent->deviceInfo.addr,
    //                                           pEvent->deviceInfo.addrType);
    //          }
    //        }
              SimpleBLECentral_addDeviceInfo(pEvent->deviceInfo.addr,
                                                         pEvent->deviceInfo.addrType);
          }
          break;

    You should also ensure DEFAULT_DEV_DISC_BY_SVC_UUID is set to FALSE. If your device is not discovered in the first DEFAULT_MAX_SCAN_RES advertisements, you will have to retrigger the scan. Setting DEFAULT_MAX_SCAN_RES to a larger amount allows more scan results with a higher likelyhood your advertisement is received, so do try this too.

  • Hi Ammar,

    I use SDK v1.50 and it can work fine.

    Thanks.