Other Parts Discussed in Thread: BLE-STACK
Hello,
we use the ble stack VERSION 3.1.1 (SDK 1.50.00.58) and buildt our project on top of the multi-role example (BLE 4.2). We are working with IAR and LAUNCHXL debugger.
We want to scan one only ble sensor indefinitely. The sensor advertises it's Information every second. According to this tutorial - http://dev.ti.com/tirex/content/simplelink_academy_cc2640r2sdk_1_14_02_04/modules/blestack/ble_scan_adv_basic/ble_scan_adv_basic.html - we set the scan duration to 0:
// === SOLUTION [Scan indefinitely] === // Scan duration in ms #define DEFAULT_SCAN_DURATION 0 // ... static void SimpleBLECentral_init(void) { // ... GAP_SetParamValue(TGAP_GEN_DISC_SCAN, DEFAULT_SCAN_DURATION); GAP_SetParamValue(TGAP_LIM_DISC_SCAN, DEFAULT_SCAN_DURATION); // ==== END SOLUTION ====
The whitelist is set and we also filter duplicate advertisers:
GAP_SetParamValue(TGAP_FILTER_ADV_REPORTS, FALSE);
The scan starts and works fine for some time. After 20 to 40 scans the scanning will stop - in debug mode as well as in normal run mode.
We run 4 Tasks:
ICall_createRemoteTasks();
GAPRole_createTask(); //for Advertising from Bluetooth device, not relevant for this issue, (tried with advertising ON and OFF)
SPPBLEServer_CreateTask(); //for Scanning
UartTask_CreateTask(); //for IPC
Changing the variable DEFAULT_MAX_SCAN_RES has no influence... (since it means receiving scan results from different devices).
We also tried to cancel discovery (scanning) inside GAP_DEVICE_INFO_EVENT with GAPRole_CancelDiscovery() (tested queued and unqueued) and restart discovery (scanning) inside of GAP_DEVICE_DISCOVERY_EVENT with GAPRole_StartDiscovery(DEVDISC_MODE_ALL, TRUE/FALSE, 1U) (tested queued and unqueued).
Restarting scanning with a timer doesn't help either.
So maybe there is a memory leakage...
Increasing the task stack size and changing the HEAPMGR_SIZE to 4000/7000 (increased, currently 3072) or 0 (auto) seems to have no effect... I would expect that GAP_DEVICE_DISCOVERY_EVENT would reset/free the allocated memory.
Do you have any suggestions how to solve this issue?
Thanks a lot,
Martin