This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Scan doesn't work after receiving BLE_GAP_EVT_TIMEOUT with timeout.src = BLE_GAP_TIMEOUT_SRC_CONN

I'm doing this:

1. Start a scan, with these parameters:

#define SCAN_INTERVAL           0x00A0                                  /**< Determines scan interval in units of 0.625 millisecond. */
#define SCAN_WINDOW             0x0050                                  /**< Determines scan window in units of 0.625 millisecond. */
#define SCAN_TIMEOUT            0x0002                                  /**< Timout when scanning. 0x0000 disables timeout. */

  .active   = 0,
  .scan_phys = BLE_GAP_PHY_AUTO,
  .interval = SCAN_INTERVAL,
  .window   = SCAN_WINDOW,
  .timeout  = SCAN_TIMEOUT,
  .scan_phys         = BLE_GAP_PHY_1MBPS,
  .filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL,

2. Looking for a suitable peripheral in BLE_GAP_EVT_ADV_REPORT using the COMPLETE_LOCAL_NAME and MANUFACTURER_SPECIFIC_DATA fields.

3. Calling sd_ble_gap_connect a suitable peripherical is found

Sometimes for some reason the connection process witll timeout and I will get a BLE_GAP_EVT_TIMEOUT event with timeout.src set to BLE_GAP_TIMEOUT_SRC_CONN. As far as I understand this means the connection process timed out. I try to restart scanning in that case. But from that point onward the scanning will be pretty erratic and will most likely not find the pheriperical, even when I can see it advertising in my cell phone using NRF Connect with a ~23ms interval.

It behaves as if the connection was somehow still using resources, even when the calls to sd_ble_gap_scan_start() do not fail and they timeout appropriately without finding anything.

I had this problem using the old s140_nrf52840_5.0.0-2.alpha soft device and I migrated to SDK 15 in hopes this will go away, but I'm still seeing the problem with s140 6.0 SD.

Any ideas?

Parents
  • Hi,

    Can you capture a sniffer trace and send it to me to see what is happening over the air?

  • Ok, this is the capture, what I found and what this capture is:

    1. e2:1a:5b:69:be:c7 is continuously advertising this is a nrf52840 running sd140 v6

    2. 43:e5:2d:c0:ed:d4 is scanning but not getting any BLE_GAP_EVT_ADV_REPORT events (this is also a nrf52840 sd140v6)

    3. This goes for quite a bit until I use NRF Connect on my android phone (for some reason this doesn't appear in the capture) to connect to e2:1a:5b:69:be:c7, this succes as seen in my phone and in the nrf log.

    4. At the exact same time the android manages to connect, suddenly the nrf52840 also manages to connect and works fine for the rest of the connection.

    This happens randomly, but once it starts happening it will continue to work very weird for quite a while, and at other times I can go on working for quite a while without failing.

Reply
  • Ok, this is the capture, what I found and what this capture is:

    1. e2:1a:5b:69:be:c7 is continuously advertising this is a nrf52840 running sd140 v6

    2. 43:e5:2d:c0:ed:d4 is scanning but not getting any BLE_GAP_EVT_ADV_REPORT events (this is also a nrf52840 sd140v6)

    3. This goes for quite a bit until I use NRF Connect on my android phone (for some reason this doesn't appear in the capture) to connect to e2:1a:5b:69:be:c7, this succes as seen in my phone and in the nrf log.

    4. At the exact same time the android manages to connect, suddenly the nrf52840 also manages to connect and works fine for the rest of the connection.

    This happens randomly, but once it starts happening it will continue to work very weird for quite a while, and at other times I can go on working for quite a while without failing.

Children
No Data
Related