Other Parts Discussed in Thread: SYSBIOS
Hello
We are using simplelink_cc13x2_26x2_sdk_3_20_00_68 with IAR EWARM v8.32.1 and a CC2642R rev E based board. We started with the Simple Central BLE5 application included with the SDK, removed the menu, did some re-arranging, and added a simple test hook which just starts a 5 second scan and traces out the response data as GapScan reports it. When we receive GAP_EVT_SCAN_DISABLED, we wait a second and start another scan. After a few scans it crashes. I enabled the debug build to get HeapTracker and started tracing heap usage after each scan. Here's the routine I call to start a scan (lifted from Simple Central):
***********************************************************
// Set Scanner Event Mask GapScan_setEventMask(GAP_EVT_ADV_REPORT | GAP_EVT_SCAN_DUR_ENDED | GAP_EVT_SCAN_DISABLED); // Set Scan PHY parameters GapScan_setPhyParams(DEFAULT_SCAN_PHY, SCAN_TYPE_ACTIVE, SCAN_PARAM_DFLT_INTERVAL, SCAN_PARAM_DFLT_WINDOW); // Set Advertising report fields to keep temp16 = SC_ADV_RPT_FIELDS; GapScan_setParam(SCAN_PARAM_RPT_FIELDS, &temp16); // Set Scanning Primary PHY temp8 = DEFAULT_SCAN_PHY; GapScan_setParam(SCAN_PARAM_PRIM_PHYS, &temp8); // Set LL Duplicate Filter temp8 = SCAN_FLT_DUP_ENABLE; GapScan_setParam(SCAN_PARAM_FLT_DUP, &temp8); // Set PDU type filter - // Only 'Connectable' and 'Complete' packets are desired. // It doesn't matter if received packets are // whether Scannable or Non-Scannable, whether Directed or Undirected, // whether Scan_Rsp's or Advertisements, and whether Legacy or Extended. temp16 = SCAN_FLT_PDU_CONNECTABLE_ONLY | SCAN_FLT_PDU_COMPLETE_ONLY; GapScan_setParam(SCAN_PARAM_FLT_PDU_TYPE, &temp16); // start the scan GapScan_enable(0, 5000, 0);
*************************************************************
Here are the relevant traces:
HEAPMGR_CONFIG: 02 HEAPMGR_SIZE: 30000
scan start
Scan end e=15 n=0 r=1
Heap Usage: Total Sz: 30000, Free: 11776, LFS: 11608
Scan complete
scan start
Scan end e=15 n=0 r=1
Heap Usage: Total Sz: 30000, Free: 6016, LFS: 5840
Scan complete
scan start
Scan end e=15 n=0 r=1
Heap Usage: Total Sz: 30000, Free: 2888, LFS: 2680
Scan complete
scan start
The application then exceptions after this (the actual memory values vary from run to run but you see the trend).
I've tried calling GapScan_discardAdvReportList() after each scan completes but it doesn't help. We sometimes get the SC_EVT_INSUFFICIENT_MEM event as well. Any ideas?
Thanks
Mark