BlueNRG-MS v7.2c Mode4 simultaneous Scan & Advertise example?
I have achieved scanning or advertising as well as a connection as a slave to 1 master and simultaneously a master of 2 slaves.
Now I need simultaneous scan & advertise (whether or not in connection as a slave or master), but cannot achieve it.
Would someone please point me to an example which achieves this or show some code snippets that worked for them?
I am following guidelines of en.DM00141271 BlueNRG Prog Man Rev 6 Dec 2016, Chapter 4: BlueNRG multiple connections timing strategy
Specifically wrt advice 4:
Every time you start Advertising:
b) If not Direct Advertising, choose Advertising_Interval_Min = Advertising_Interval_Max such that (Advertising_Interval_Min + 5ms) is an integer multiple of the shortest allocated connection interval
The error I am getting is 0x85: BLE_STATUS_INTERVAL_TOO_LARGE
Order of work:
0. initialize Mode4:
uint8_t DataMode = 4;
aci_hal_write_config_data(CONFIG_DATA_MODE_OFFSET, CONFIG_DATA_MODE_LEN, &DataMode));
and of course dual gap role
uint8_t GapRole = GAP_PERIPHERAL_ROLE_IDB05A1 | GAP_CENTRAL_ROLE_IDB05A1;
aci_gap_init_IDB05A1(GapRole, 1, strlen(DeviceName), &gapRoleHdl, &devNameHdl, &devAppearHdl));
1. start scanning forever:
aci_gap_start_selective_conn_establish_proc(ACTIVE_SCAN, 96, 16, PUBLIC_ADDR, true, 2, whitelist);
(so 60-msec scan interval, 10-msec scan window)
2. get advertisement from one of the two slaves in the whitelist and connect:
aci_gap_create_connection(96, 16, AddrType, Addr, PUBLIC_ADDR, 48, 48, 2, 72, 16, 16);
(so same scan parameters as above and 60-msec conn interval, 10-msec conn length)
3. attempt to start advertising (while previously started scan continues looking for second slave in the whitelist):
aci_gap_set_discoverable(ADV_IND, 44, 44, PUBLIC_ADDR, NO_WHITE_LIST_USE, 0, NULL, 0, NULL, 0, 0)))
(so 55-msec advertising interval, obeying advice to be even interval of (60-msec - 5-msec)
Return value of above call is always error 0x85.
#simultaneous-scan-&-advertise #ble_status_interval_too_large