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

Bluetooth: Cannot connect if extended advertising is enabled in prj.conf #35596

Closed
chrisswinchatt-arm opened this issue May 25, 2021 · 5 comments · Fixed by #35670
Closed

Bluetooth: Cannot connect if extended advertising is enabled in prj.conf #35596

chrisswinchatt-arm opened this issue May 25, 2021 · 5 comments · Fixed by #35670
Assignees
Labels
area: Bluetooth Controller area: Bluetooth bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@chrisswinchatt-arm
Copy link

chrisswinchatt-arm commented May 25, 2021

Describe the bug

A Zephyr program compiled with the following in prj.conf:

CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_PER_ADV=y

Calling bt_conn_le_create after discovering a peer returns -5 (-EIO) when compiled with the above config. Removing or setting to n the CONFIG_BT_EXT_ADV option and recompiling corrects the behaviour.

CONFIG_BT_EXT_ADV CONFIG_BT_PER_ADV Return value of bt_conn_le_create
n n 0
n y 0
y n -5
y y -5

To Reproduce
Steps to reproduce the behavior:

  1. Compile the code in this gist
  2. Flash to the boards; I tested with nucleo_wb55rg, disco_l475_iot1 and nrf52840_mdk; which is central and which is peripheral doesn't matter
  3. Use serial console to send A to one board to tell it to advertise and S to the other to tell it to scan
  4. The error is shown on the serial console of the scanning board when it attempts to connect

Expected behavior
It should be possible for a single program to support both connect & periodic sync.

Impact
Showstopper

Logs and console output

*** Booting Zephyr OS build zephyr-v2.5.0-2959-g9a14f627426b  ***
Initialising...
Press A to start advertising or S to start scanning
Scanning for 10 seconds
Connecting to Issue (80:e1:26:1b:76:02)
bt_conn_le_create: error -5

Environment (please complete the following information):

  • OS: (e.g. Linux, MacOS, Windows) Windows
  • Toolchain (e.g Zephyr SDK, ...): Zephyr / West
  • Commit SHA or Version used: 9a14f62

Additional context
N/A

@chrisswinchatt-arm chrisswinchatt-arm added the bug The issue is a bug, or the PR is fixing a bug label May 25, 2021
@chrisswinchatt-arm
Copy link
Author

Update: Created a simplified Gist.

Our real program is in C++ but the Gist in C also reproduces the error so C++ support is not responsible.

@carlescufi carlescufi changed the title [BLE] Boards cannot connect if extended advertising is enabled in prj.conf Bluetooth: Cannot connect if extended advertising is enabled in prj.conf May 25, 2021
@joerchan
Copy link
Contributor

Support for extended advertising needs to be enabled in the zephyr controller.
CONFIG_BT_CTLR_ADV_EXT=y

@carlescufi
Copy link
Member

@chrisswinchatt-arm if you objective is to come up with a power consumption comparison between different RTOS, may I point out that you need to take into account not only Bluetooth, but also things like other peripherals (the UART in particular) as well as the behavior of the application itself.

@joerchan
Copy link
Contributor

Did some digging because it was weird that only creating connections was affected, but advertising and scanning worked fine.

Turns out the feature bit checking was inconsistent, I've created a fix for it.

@chrisswinchatt-arm
Copy link
Author

chrisswinchatt-arm commented May 26, 2021

Thanks for speedy response all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Controller area: Bluetooth bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants