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.

RTOS/CC2640R2F: 2640R2 central_role scan the phone advertiment problem

Part Number: CC2640R2F

Tool/software: TI-RTOS

When I used the 2640R2 Bluetooth central role to scan the advertising of mobile phones, I encountered the problem that it was difficult to scan the advertising of mobile phones. Specific tests are as follows:

1. The version of the protocol stack used is the central role of simplelink_cc2640r2_sdk_2_20_00_49

2. Set the DEFAULT_MAX_SCAN_RES parameter to 30, but also adjust to 50

3. SCAN params as follow:

DEFAULT_SCAN_DURATION=500
DEFAULT_SCAN_WIND =79
DEFAULT_SCAN_INT=80

4. When Android advertising, the advertising interval is about 130 ms; when Apple advertising, the advertising interval is about 35 ms for the front ground and 185 ms for the back ground.

When using the above parameters, it works normally, but the output of scanning results is too slow, 500 ms output once.

When DEFAULT_SCAN_DURATION is less than the advertising interval of the mobile phone (e.g. using 100ms), the advertising of the mobile phone can not be scanned at all.

When DEFAULT_SCAN_DURATION is much larger than the cell phone interval (e.g. 300ms), it is easier to scan the advertising of the cell phone.

adjust the parameters of DEFAULT_SCAN_WIND and DEFAULT_SCAN_INT did not improve this problem.

How should I set it up so that the central can quickly scan the advertising of the mobile phone?

  • Hello Chen,
    Why not use the latest SDK?
    In SimpleCentral_processRoleEvent() check the GAP_DEVICE_INFO_EVENT case. The GAP_DEVICE_INFO_EVENT case stores individual device records as they come in. The GAP_DEVICE_DISCOVERY_EVENT case stores the complete list after the scan has ended. You can add checks in the GAP_DEVICE_INFO_EVENT case and manually cancel scan if needed.

    BTW, you can also set scan window equal to scan interval:
    DEFAULT_SCAN_WIND =80
    DEFAULT_SCAN_INT=80
  • Hello Errik V,

    1. We've tried other SDKs, but it's the same thing.

    2. Of course, we know to check The GAP_DEVICE_INFO_EVENT and GAP_DEVICE_DISCOVERY_EVENT, and the result is taken directly from here.

    3. We mentioned earlier that we should adjust DEFAULT_SCAN_WIND and DEFAULT_SCAN_INT, including increasing, reducing, and making them equal.

    4. Additionally, when we use 2640R2 as Bluetooth slave, it works normally.

  • Hello Chen,
    2. Of course, we know to check The GAP_DEVICE_INFO_EVENT and GAP_DEVICE_DISCOVERY_EVENT, and the result is taken directly from here.
    My point was that GAP_DEVICE_INFO_EVENT should come right after the advertisement is scanned. How long does it take before you receive GAP_DEVICE_INFO_EVENT compared to GAP_DEVICE_DISCOVERY_EVENT?

    4. Additionally, when we use 2640R2 as Bluetooth slave, it works normally.
    What do you mean by "normally"?
    At what interval does 2640R2 advertise?
  • 1. as what i'm said before, When DEFAULT_SCAN_DURATION is less than the advertising interval of the mobile phone (e.g. using 100ms,the phone advertisement interval is 135ms or 185ms), the advertising of the mobile phone can not be scanned at all. it mean the GAP_DEVICE_INFO_EVENT and GAP_DEVICE_DISCOVERY_EVENT have not any results.
    2. when we use 2640R2 as slave, no matter what the central_role scan interval is, the slave can be scaned in one or two advertising interval.
    (e.g. using 100ms to scan ,the 2640R2 advertisement interval is 200ms(we try 100ms,200ms,300ms),it almost can have the scan result in every 200ms or 400ms; )

    so the key point is when central_role DEFAULT_SCAN_DURATION is less than the advertising interval of the mobile phone, It can't scan any results. but 2640R2 as slave does not have this problem.
  • Hello Eirik,

    the different between the 2640R2 and the phone advertising  is the addresstype, the 2640R2 is the "Public addresstype"and the phone is "random addresstype",show as below:

  • What happens if you change the 2640R2 device address to random?
    There could be difference in link quality which can cause advertisements from the mobile phone to be missed. If you run a single scan duration shorter than the advertising interval of the mobile phone you might very well never catch the packet. In theory this could also occur with the 2640R2 as broadcaster.
  • Hello Eirik,

    I tried to set 2640R2 device address to random, but it doesn't work, I also tried to set the address of 2640R2 to be the same as the mobile phone., It also offers the following tips:

    by the way,we also test the Nordic N52832, it work well, It can output scanning results in almost every broadcast cycle(185ms) or two(370ms).

  • Hello Chen,

    Are you using BLE3 on simplelink_cc2640r2_sdk_2_40_00_32?

    Did you disable the filtering that only add devices with the SIMPLEPROFILE_SERV_UUID (used in simple_peripheral).

    // TRUE to filter discovery results on desired service UUID
    #define DEFAULT_DEV_DISC_BY_SVC_UUID FALSE
  • Hello Eirik,
    The problem has been resolved. Only need to set TGAP_FILTER_ADV_REPORTS to FALSE on it.
    thank you.