adafruit / adafruit/Adafruit_nRF52_Arduino

Bluefruit.Central.connect Connection Timeout?

Open
#789 3 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
C
Stars
699
Forks
570
PR merge metrics
No merged PRs in 30d

Description

### Operating System

Windows 10

### IDE version

Ardino 2.2.0

### Board

Adafruit Feather nrf52832

### BSP version

1

### Sketch

https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/libraries/Bluefruit52Lib/examples/Central/central_bleuart/central_bleuart.ino

### What happened ?

...
void scan_callback(ble_gap_evt_adv_report_t* report) {
Bluefruit.Central.connect(report);
}
...

After sending a connection request, Adafruit nRF52 ble central stops scanning if a connection is not established. Bluefruit.Scanner.resume(); or Bluefruit.Scanner.start(0); commands do not respond.

As above, when a device is found that can be connected to, I send the connect command.
If the target mobile device moves away or turns off after sending this command, the connection cannot be established. And the connection hangs. Scanning stops completely..
There should be a connection timeout option here. If the connection does not occur after x milliseconds after the connection is attempted, the operation should be aborted. But the connection hangs.
How do I solve this?

### How to reproduce ?

Here's how I do the test.
- Launch Adafruit central ble.
- Start Android application (uart service peripheral).
- Blecentral find the android device in the scan and the connection request is sent.
- Meanwhile, the android application is terminated.
- Ble central connection request hangs.
- Re-open the Android app and start advertising.
- But the device cannot be found because the scanning does not work.

### Debug Log

...

### Screenshots

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with libraries/Bluefruit52Lib/examples/Central/central_bleuart/central_bleuart.ino and trace the scan_callback call to Bluefruit.Central.connect(report). Reproduce the failed connection using the Android app steps, then inspect the scanner and connection APIs to determine why scanning cannot resume. Done means an unsuccessful connection attempt times out or aborts and scanning works again.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, c
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.