We are using the latest pc-ble-driver with SoftDevice v6.1.1 and latest connectivity firmware on an nrf52832 (s132) which is connected via usb-uart.
We were previously using v5, but had some issues with setting TX power and so have updated to v6.1.1 which resolved that issue. But we are now no longer receiving any scan responses.
From what I've read so far, this might have something to do with the change in the API requiring the scan to be triggered each time a BLE_GAP_EVT_ADV_REPORT event occurs, and the connection being too slow to catch the scan responses.
The parameters used for starting the scan are:
#define BLE_SCAN_EXTENDED 1 #define SCAN_INTERVAL 0x00A0 #define SCAN_WINDOW 0x0050 static ble_gap_scan_params_t ble_scan_params = { #if NRF_SD_BLE_API >= 6 .extended = BLE_SCAN_EXTENDED, .report_incomplete_evts = 0, #endif .active = 1, #if NRF_SD_BLE_API >= 6 .filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL, .scan_phys = BLE_GAP_PHY_1MBPS, #else .use_whitelist = 0, // TODO see if we can use this to pre-filter on service-uuid. .adv_dir_report = 0, #endif .interval = SCAN_INTERVAL, /**< Scan interval between 0x0004 and 0x4000 in 0.625 ms units (2.5 ms to 10.24 s). */ .window = SCAN_WINDOW, /**< Scan window between 0x0004 and 0x4000 in 0.625 ms units (2.5 ms to 10.24 s). */ .timeout = BLE_GAP_SCAN_TIMEOUT_UNLIMITED, /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ #if NRF_SD_BLE_API >= 6 .channel_mask = { 0, 0, 0, 0, 0 }, #endif }; #if BLE_SCAN_EXTENDED == 1 static uint8_t m_scan_buffer_data[BLE_GAP_SCAN_BUFFER_EXTENDED_MAX]; #else static uint8_t m_scan_buffer_data[BLE_GAP_SCAN_BUFFER_MAX]; #endif static ble_data_t m_scan_buffer = { m_scan_buffer_data, #if BLE_SCAN_EXTENDED == 1 BLE_GAP_SCAN_BUFFER_EXTENDED_MAX #else BLE_GAP_SCAN_BUFFER_MAX #endif };
As you can see active is set to 1, which from my understanding should allow for scan requests to be sent automatically and scan responses coming in as BLE_GAP_EVT_ADV_REPORT events. (We've also tried with both extended being set to 1 and 0.) The scan is then started using:
uint32_t error_code = sd_ble_gap_scan_start(adapter, &ble_scan_params, &m_scan_buffer);
And continued in the callback when receiving
static void ble_evt_dispatch(adapter_t* adapter, ble_evt_t* p_ble_evt) { #if NRF_SD_BLE_API >= 6 if(p_ble_evt->header.evt_id == BLE_GAP_EVT_ADV_REPORT) { sd_ble_gap_scan_start(adapter, nullptr, &m_scan_buffer); LOG_DEBUG("Found beacon - (%d, %d).", p_ble_evt->evt.gap_evt.params.adv_report.type.scannable, p_ble_evt->evt.gap_evt.params.adv_report.type.scan_response); } #endif ... }
This pseudo-code only logs Found beacon - (1, 0) and sometimes Found beacon - (0, 0) - but I almost never see Found beacon - (1, 1). I haven't measured but let's say only once every 10000 detections.
Since I mostly see devices which are scannable, I would expect to see a lot more scan responses, I also have several devices running for which I know they are able to send scan responses (tested using iOS app).
I came across this post: https://devzone.nordicsemi.com/f/nordic-q-a/50082/pc-ble-driver-no-scan-response which seems to be a similar issue. But since that post is from over a year ago I was hoping there might be a solution for this.
The scan responses are a vital part for an application we are developing, but I have not been able to find a solution to be able to get the scan responses.
Is there anything basic we are missing which is preventing the scan responses to come in through the callback? Is there any way to manually send a scan request and get the response for that?