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.

Scanning for BLE Beacons with CC2540 is very slow

Other Parts Discussed in Thread: CC2540

Hi,

we have some BLE-Beacons which are advertising every 100ms. Now we are trying to receive the advertising Packets on Windows with the CC2540 USB dongle flashed with the cc2540_ble1.1_USBdongle_HostTestRelease_Master.hex file.
As basis we are using the Health Demo(http://processors.wiki.ti.com/index.php/Category:HealthDemo).
There must be something very basic we are missing, but we are getting a response every 4-5 seconds only! Too slow!

Here is what we did:

Set the scan rate to 10ms

Bluetooth.HCICmds.GAPCmds.GAP_SetParam GAP_SetParamWindow = new Bluetooth.HCICmds.GAPCmds.GAP_SetParam();
GAP_SetParamWindow.paramId = CADTracker.Bluetooth.HCICmds.GAP_ParamId.TGAP_GEN_DISC_SCAN_INT;
GAP_SetParamWindow.value = 10;
beacon_SendGAP_SetParam(GAP_SetParamWindow); 



Wait for a success response, then set the window to 10ms;

Bluetooth.HCICmds.GAPCmds.GAP_SetParam GAP_SetParamInterval = new Bluetooth.HCICmds.GAPCmds.GAP_SetParam();
GAP_SetParamInterval.paramId = CADTracker.Bluetooth.HCICmds.GAP_ParamId.TGAP_GEN_DISC_SCAN_WIND;
GAP_SetParamInterval.value = 10;
beacon_SendGAP_SetParam(GAP_SetParamInterval);



Wait for a success response, then every 20 seconds call a device discovery

// scan
Bluetooth.HCICmds.GAPCmds.GAP_DeviceDiscoveryRequest GAP_DeviceDiscoveryRequest = new Bluetooth.HCICmds.GAPCmds.GAP_DeviceDiscoveryRequest();
GAP_DeviceDiscoveryRequest.nameMode = Bluetooth.HCICmds.GAP_EnableDisable.Enable;
GAP_DeviceDiscoveryRequest.whiteList = Bluetooth.HCICmds.GAP_EnableDisable.Disable;
GAP_DeviceDiscoveryRequest.mode = (HCICmds.GAP_DiscoveryMode)0x3;
// send the request
beacon_SendGAP_DeviceDiscoveryRequest(GAP_DeviceDiscoveryRequest);

Thank you for your Help!

  • Hi,

    You can set parameter TGAP_GEN_DISC_SCAN to modify the total scanning time. Setting it to 1000 for example, will reduce it to 1 second.

    The scan interval and scan window is used to define duty cycle during that time.

    Best Regards

  • Hi,

    I'm not sure where you got the hex file - it's not a part of the latest stack at least. What I say below is true for the latest stack sdk.

    Keep in mind that unless you set TGAP_FILTER_ADV_REPORTS to FALSE, duplicate events will be ignored.

    Even when this is set to FALSE, identical reports within one scan cycle will be ignored.

    Also, a tip could be to increase the scan window rather than decrease it. This means there is less overhead for the CPU to change around its things, and so more time actively listening.

    Another tip then, taking into consideration the duplicate filtering, could be to reduce the scan time TGAP_GEN_DISC_SCAN to a lower value, and just restart scanning more often.

    Best regards,
    Aslak

  • Hi,

    This explains a lot. We will try this out and let you know. Thank you.