Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluefruit.Central.connect Connection Timeout? #789

Open
macirtr opened this issue Sep 10, 2023 · 3 comments
Open

Bluefruit.Central.connect Connection Timeout? #789

macirtr opened this issue Sep 10, 2023 · 3 comments
Labels

Comments

@macirtr
Copy link

macirtr commented Sep 10, 2023

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

@macirtr macirtr added the Bug label Sep 10, 2023
@macirtr
Copy link
Author

macirtr commented Sep 18, 2023

nkolban/esp32-snippets#874
I found a thread of programmers having similar problems on Esp32. The semaphore was causing the deadlock. They found a solution by reducing the semaphore time. So I replaced all portMAX_DELAY data in the library with 3UL, but it didn't work.

@macirtr
Copy link
Author

macirtr commented Sep 18, 2023

I thought maybe this error was caused by the new version (1.5.0). I installed the old library version (0.21) and tried it. But there is the same problem.

@hathach
Copy link
Member

hathach commented Nov 30, 2023

late response, can you post the log with debug level = 2 or 1, to see if there is any error output when the issue occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants