Other Parts Discussed in Thread: CC2640
Tool/software: Code Composer Studio
Hi everyone,
It is my first post here and I hope I didn't anything wrong.
I'm a beginner with the CC2640R2F hardware and software and I use the "multirole" example of "blestack" as a start point.
My goal is to read ALL the advertising frames sent by the devices around. I need to get all the advertising frames because latency is a critical point and I expect to not loose some with would increase latency.
I tried the solution below, which seems to work, but the latency is too long (sometime, half a second or more). As the advertising device send frames with an interval of 100ms, I would get the data on the CC2640 with 100ms latency maximum.
- First, I start a scan by adding the line "mr_doScan(0);" just before the infinite loop of "static void multi_role_taskFxn(UArg a0, UArg a1)"
- I read advertising data in "case GAP_DEVICE_INFO_EVENT:" of function "static void multi_role_processRoleEvent(gapMultiRoleEvent_t *pEvent)" : this code is executed each time a device is discovered
- Then, when scan ends, "case GAP_DEVICE_DISCOVERY_EVENT:" of same function is executed and I restart a scan thanks to "mr_doScan(0)"
Then I need to tweak the scan duration (#define DEFAULT_SCAN_DURATION) to a smaller value, such as 150-200 ms, to get a better latency. If the scan duration is too short (< 100 ms), latency starts to rise again, the minimum seems to be around 150 ms.
Is this the optimal way or can I do it differently ?
Thanks,
Damien