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-Q1: how scan interval & window work during scanning duration

Part Number: CC2640R2F-Q1


Hi TI experts,

I am using the following configuration.

Scan duration is 1800ms, scan interval is 80(50ms), and scan window is 80 or less 80,

My understanding is that the scan interval will happen every 50ms during 1800 ms by switching between 37 and 38 and 39 continuously.

And if an advertising packet on a channel(37, 38, or 39) is matched/synchronized with a scan window of a channel(37, 38, or 39), that is, channel index is synchronized, the advertising report is generated by LL.

Right?

If right, I don't know why my understanding doesn't work with my testing condition.

My testing condition is as below.

an advertising devices advertises every 1.5 seconds.

And this same advertising packet is on 37, 38, and 39 channels. And the Tduration from 37 to 39 is less than 2ms.

And the advertising interval between current 37 and next 37 is around 110ms. I will call this 1 frame.

And this advertising packet happens 4 times. That is, 4 frames happen at every 15-second.

My expectation is the advertising report event from BLE stack side happen 4 times. So, at least, when each frame should be matched with a scan window channel among 3 channels.

Let me know how to assign the values to get the 100% hit-ratio with 4 times advertising report events.

BR,

Ji Won

  • Hi Ji Won,

    Take a look at the following SimpleLink Academy training that covers all the details regarding scanning and advertising: dev.ti.com/.../

    Regards,
    Fredrik
  • Thanks for your guide.

    But it is not enough for me to understand and solve my issue. Actually, up to now, I have read many times to understand your scanning configuration concept from source code, from here. Just to clarify my understanding, I asked the question as above.

    Anyway, I tried to compare the same operation with BLE 4.2 stack environment.

    I used the evaluation board, TI CC2640R2 LP board.

    To make sure that the same configuration is being used, I simply utilized that the advertising report event callback function from both BLE solutions as the advertiser is using non-connectable mode.

    Whenever any adverting report events from BLE stack side, the address information is being displayed on PC terminal.

    The non-connectable device advertises 4 times with the same advertising data packet as I explained above.

    In this above condition, the TI BLE v4.2 solution shows that usually 3 or 4 adverting report events, while TI BLE v5.x solution shows usually 1 or 2 events, sometimes, no catch.

    This means that v5.x stack has some issue with respect to the advertising report events..

    Scan interval is 60ms, Scan window is 30ms, Scan duration is 4000ms, GAP_SetParamValue(TGAP_FILTER_ADV_REPORTS, FALSE);

    I have to have the advertising report events at least more than 3 times.

    So, I hope you to check for my same condition.

    Like below, I just touched from your C:\ti\simplelink_cc2640r2_sdk_1_35_00_33\examples\rtos\CC2640R2_LAUNCHXL\ble5stack\simple_central\tirtos\iar

    added FPGA_AUTO_CONNECT

    // TRUE to filter discovery results on desired service UUID
    #define DEFAULT_DEV_DISC_BY_SVC_UUID          FALSE

    // Scan duration in ms
    #define DEFAULT_SCAN_DURATION                 4000

    // Scan interval in ms in any discovery or connection establishment procedures
    #define DEFAULT_SCAN_INTERVAL                 96 // 96(n*0.625ms) = 60ms(iOS devices OK, but 48(30ms) is better for Andriod devices)
    #define DEFAULT_SCAN_WINDOW                   48 // 48(n*0.625ms) = 30ms, 8(n*0.625ms) = 5ms (iOS device OK, but 16(10ms) is better for Android devices)  

      // Setup GAP
      GAP_SetParamValue(TGAP_GEN_DISC_SCAN, DEFAULT_SCAN_DURATION);
      GAP_SetParamValue(TGAP_LIM_DISC_SCAN, DEFAULT_SCAN_DURATION);

      // Setup Scan Interval & Scan Window in limited discovery procedure during "Scanning state"
      GAP_SetParamValue(TGAP_LIM_DISC_SCAN_INT, DEFAULT_SCAN_INTERVAL);
      GAP_SetParamValue(TGAP_LIM_DISC_SCAN_WIND, DEFAULT_SCAN_WINDOW);

      // Setup Scan Interval & Scan Window in general discovery procedure during "Scanning state"
      GAP_SetParamValue(TGAP_GEN_DISC_SCAN_INT, DEFAULT_SCAN_INTERVAL);
      GAP_SetParamValue(TGAP_GEN_DISC_SCAN_WIND, DEFAULT_SCAN_WINDOW);  
     
      GAP_SetParamValue(TGAP_FILTER_ADV_REPORTS, FALSE);

       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);

             }

           }

           Display_print2(dispHandle, 4, 0, "%s;%d;", Util_convertBdAddr2Str(pEvent->deviceInfo.addr), pEvent->deviceInfo.rssi);        

         }

         break;

        case GAP_DEVICE_DISCOVERY_EVENT:
          {
            // discovery complete
            scanningStarted = FALSE;

            // if not filtering device discovery results based on service UUID
            if (DEFAULT_DEV_DISC_BY_SVC_UUID == FALSE)
            {
              // Copy results
              scanRes = pEvent->discCmpl.numDevs;
              memcpy(devList, pEvent->discCmpl.pDevList,
                     (sizeof(gapDevRec_t) * scanRes));
            }

            //Display_print1(dispHandle, 2, 0, "Devices Found %d", scanRes);

            if (scanRes > 0)
            {
    #ifndef FPGA_AUTO_CONNECT
              Display_print0(dispHandle, 3, 0, "<- To Select");
            }

            // Initialize scan index.
            scanIdx = -1;

            // Prompt user that re-performing scanning at this state is possible.
            //Display_print0(dispHandle, 5, 0, "Discover ->");

    #else // FPGA_AUTO_CONNECT
              //SimpleBLECentral_connectToFirstDevice();
              SimpleBLECentral_startGapDiscovery();
            }
    #endif // FPGA_AUTO_CONNECT
          }
          break;

    BR,

    Ji Won

  • the RF antenna configuration is not matched with board configuration. after getting matched, improved.