Hello developers,
I am using nRF52840 feather from adafruit as a ble central board.
FIrst of all, I tried to filter just only for my beacons with UUID. I saw a ble central example ble_app_hrs_c and needed a service UUID.
So I gave it 0xFEAB in my code. But the board scans still many other bluetooth modules which are not beacons.
How can I correctly filter only for beacons?
static char const test_periph_uuid[] = {0xab, 0xfe};
static void scan_init(void)
{
ret_code_t err_code;
nrf_ble_scan_init_t init_scan;
memset(&init_scan, 0, sizeof(init_scan));
init_scan.connect_if_match = true;
init_scan.conn_cfg_tag = APP_BLE_CONN_CFG_TAG;
err_code = nrf_ble_scan_init(&m_scan, &init_scan, scan_evt_handler);
APP_ERROR_CHECK(err_code);
err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_UUID_FILTER, test_periph_uuid);
APP_ERROR_CHECK(err_code);
err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_UUID_FILTER, false);
APP_ERROR_CHECK(err_code);
}
Furthermore, I want to connect simultaneous many beacons (maybe 4 or more) with my board. But if I tried to connect 4 beacons at first, one of them can't be scanned and the other one could be rarely scanned. For example, first beacon is scanned 10 times, second beacon 0 times, third beacon 2 times and fourth beacon 42 times.
I saw the ble_app_multilink_central example for this problem and it didn't help well.
Why does it randomly work? How can the board scan in order? I wrote it with if function in sequence from 1 to 4.
#define NRF_SDH_BLE_CENTRAL_LINK_COUNT 8
/**@brief LED Button collector initialization. */
static void lbs_c_init(void)
{
ret_code_t err_code;
ble_lbs_c_init_t lbs_c_init_obj;
lbs_c_init_obj.evt_handler = lbs_c_evt_handler;
lbs_c_init_obj.p_gatt_queue = &m_ble_gatt_queue;
lbs_c_init_obj.error_handler = lbs_error_handler;
for (uint32_t i = 0; i < NRF_SDH_BLE_CENTRAL_LINK_COUNT; i++)
{
err_code = ble_lbs_c_init(&m_lbs_c[i], &lbs_c_init_obj);
APP_ERROR_CHECK(err_code);
}
}
And one more question is the function lbs_c_init. As the explaination, it is actually a init function for LED Button collector.
Why does it handle the number of bluetooth module for multilink?
Software specification:
Segger embedded studio for arm 5.50b
nRF5 SDK 17.0.2
Softdevice S140
Best regards,
it0406