-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Zephyr/BLE stack: Problem pairing/bonding more than one device, whilst the first device is still connected. #12946
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
Comments
Hi Zephyr group,
Sometimes it works ok & both devices become paired/bonded and stay connected, but most of the time it fails and the second device is disconnected as soon as the pairing key has been entered on the device. Here is some debug output for when the pairing/bonding of the first device works, and then when it fails for the second device: WHEN IT WORKS (FOR THE FIRST DEVICE): [ble_p] [INF] ble_p_connected: 1/4, 00:00:46:00:00:01 (public) is NOT bonded WHEN IT DOESN’T WORK (FOR THE SECOND DEVICE): ble_p] [INF] ble_p_connected: 2/4, d4:61:9d:ee:41:53 (public) is NOT bonded (see the end of this message for more detailed debug for the 2nd device pairing: when it works and when it fails. Also attached to the end of this message are snippets of the code invoked when it fails to pair. I have also attached 3 files with debug output for good & bad cases, and the code snippets (as the code formatting is messed up when posted in this bug report)) I investigated the cause of the disconnection in the Zephyr BLE stack, and found it to be caused by trx_done not being TRUE when the isr() function is called (in ctrl.c) whilst in STATE_RX _radio.state: The trx_done is set based on the value of NRF_RADIO->EVENTS_END. It seems that when the second device tries to pair, we get a BLE isr() occur whilst in STATE_RX, but NRF_RADIO->EVENTS_END is not set. Why is this happening, and is there some configuration/setting we can change to fix this, or is it a Zephyr BLE stack bug? =========================================== MORE DETAILED DEBUG FOR A GOOD AND BAD 2ND DEVICE PAIRING: GOOD: chan 0x200019c4 cid 0x0006 =========================================== BAD:
=========================================== **RELEVANT CODE SNIPPETS (From : ctrl.c and radio.c): ** u32_t radio_is_done(void) #else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER / static void isr(void)
#if defined(CONFIG_BT_CTLR_PROFILE_ISR)
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN) ||
} At the start of the function isr_radio_state_rx, trx_done is tested, and if not true, _radio.state is set to STATE_CLOSE, then the connection is closed static inline void isr_radio_state_rx(u8_t trx_done, u8_t crc_ok,
static inline void isr_radio_state_close(void)
This is the function called from code above, resulting in the connection being closed with a BT_HCI_ERR_CONN_TIMEOUT static inline void isr_close_conn(void)
#if defined(CONFIG_BT_CTLR_PHY)
|
@DeclanTraill Thank you for the detailed analysis, but could you fill the details to reproduce the issue as per the template in your first comment in this issue? Please state the Zephyr commit hash you are using, the sample you are using, the .config file for your application, any code deviations from the upstream sample implementation, the devices, boards, phone and peers used. Unless, I am made to reproduce the issue, its will be difficult to analyze the issue. Awaiting your response. |
duplicate of #13083 .. |
Closing as duplicate of #13083 |
Describe the bug
A clear and concise description of what the bug is.
What have you tried to diagnose or workaround this issue?
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Impact
What impact does this issue have on your progress (e.g., annoyance, showstopper)
Screenshots or console output
If applicable, add a screenshot (drag-and-drop an image), or console logs
(cut-and-paste text and put a code fence (```) before and after, to help
explain the issue.
Environment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: