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
  • I am also seeing a problem similar to this.   My peripheral is attempting to connect then disconnect.

    10 Seconds later repeat this action.

    For the first 20+ attempts it appears to be working fine (longest has been 3 days) then suddenly stops on the Connect.  
    This is then timed out and the scanning from that point forward fails.

    I have attempted to restart the BLE at this point and this does not resolve the issue.

    A full restart sees the peripheral connect immediately and start working again

    Any further information

  • Sorry further clarification

    On the central the following is occurring

    1.  Scan for advertising

    2.  On receipt of advertising from a specific device connect

    2a    Restarting Scanning 

    2b.  Wait Disconnect

    3  On receipt of Disconnect repeat from 1.


    When it fails the Connect (to the same device) times out.  

    1.   Attempt to scan for advertising

    2.   No advertising is received from any device

Reply
  • Sorry further clarification

    On the central the following is occurring

    1.  Scan for advertising

    2.  On receipt of advertising from a specific device connect

    2a    Restarting Scanning 

    2b.  Wait Disconnect

    3  On receipt of Disconnect repeat from 1.


    When it fails the Connect (to the same device) times out.  

    1.   Attempt to scan for advertising

    2.   No advertising is received from any device

Children
No Data
Related