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.

The accuracy of scan duration

Other Parts Discussed in Thread: BLE-STACK, CC2640

Hi TI experts,

Does the scanning procedure work fine?

I set the TGAP_GEN_DISC_SCAN to 50 ms to discover three slaves with 40 ms advertising interval. Scan window and scan interval set to 1000 ms.

I think 50-ms should discover all slaves.

But the master can't discover any devices (scanRes = 0) about 10 times of 10000 times test.

It is very unreasonable.

Do you have any idea or suggestion?

I need to set this value very accurately by Mathematical model because it's my master thesis.

Peter

  • Hello Peter,

    Please post your *exact* code changes / settings and the API values you are using to initiate the scan on CC2640 TI BLE-Stack v2.2.0.
    Also, what experiments did you run to find values that do work?

    You can measure the radio (receiver) active time by monitoring the range extender IOs on a scope, see the "CC2640 Range Extender Control" article on the BLE Wiki.

    Best wishes
  • Hi JXS,

    The following is the changed parameter about scanning.

    GAP_SetParamValue(TGAP_GEN_DISC_SCAN, 50);
    GAP_SetParamValue(TGAP_LIM_DISC_SCAN, 50);
    GAP_SetParamValue(TGAP_GEN_DISC_SCAN_INT, 1000);
    GAP_SetParamValue(TGAP_GEN_DISC_SCAN_WIND, 1000);

    The advertising interval of advertiser set to 40 ms.

    The scanner will do the next scanning procedure after it receive the GAP_DEVICE_DISCOVERY_EVENT  in my experiment.

    It executes 10000 times scanning, and record each result (scanRes).

    Do I set the wrong parameter?

    Peter

  • Please note that the TGAP scan window/interval parameters are in units of 0.625 ms as shown in the respective definitions from gap.h. So for 1000 ms, you need to set the value to 1000 / 0.625 = 1600.

    Also, you are setting your scan window & interval to 1000, which means the radio scan will scan continuously for the scan duration. However, your scan duration of 50 ms means the channel index will not increment - you will only scan channel 37, since the scan will stop before the scheduled channel index change at the end of the first scan interval.

    Did you confirm your broadcaster is indeed advertising at the expected rate?

    Best wishes
  • Hi JXS,

    Even if the short duration, we expect master should scan more than one slave.

    But it is not.

    As you can see the sniffer pic.

    Three slave is indeed advertising once every 50 ms (advertising interval = 40 ms plus random dealy = 0 ~ 10 ms).

    Is this a bug of scanning procedure? Scanning will not do exact duration of user definition.

    Maybe it has some delay on scanning when I call GAPCentralRole_StartDiscovery().

    Peter