zephyr: BLE scanning - BT RX thread hangs on.

Describe the bug During ble scan the BT RX thread hangs on and ble scan callback is not fired. This happens at random time after scan start.

To Reproduce Example: bluetooth/scan_adv west build -b nucleo_wb55rg .

scan parameters:

  • BT_HCI_LE_SCAN_ACTIVE
  • BT_LE_SCAN_OPT_NONE
  • interval=128 (tried with other values too)
  • windows=64 (tried with other values too)

Expected behavior Scanning is going continously until manually stopped.

Impact Hard reset has to be done to begin scanning again.

Logs and console output As you can see below the number of cpu ticks of BT RX thread doesn’t change for following threads analysis (time interval = 30s) aurora_issue_threads_info_cpu aurora_issue_threads_info

Environment (please complete the following information):

  • OS: Linux
  • Zephyr SDK 3.1.99
  • FUS v.1.2.0
  • ble stack: stm32wb5x_BLE_Stack_full_fw (1.12.1) on stm32wb55 nucleo
  • ble stack: stm32wb5x_BLE_HCILayer_extended_fw (1.13.2) on own hardware
  • boards: stm32wb55 nucleo, own pcb based on stm32wb55 mcu

Additional context This issue occurs on our own hardware based on stm32wb55 mcu and on stm32wb55 nucleo board. There are different ble stacks used as mentioned in Environment section.

This issue occurs at random time (from my observations this time depends on scan parameters, when scan interval and window are bigger then it’s harder to reproduce this issue).

When performing tests on scan_adv example i’ve commented the code part responsible for advertising. Only scanning is performed.

Also i tried to do some workaround and try to reset the bt stack when noticed that this issue occured, but there is another problem. When i do: (pseudocode:) bt_le_scan_disable(); hci_command->BT_HCI_OP_RESET bt_disable(); bt_enable();

I’m getting an assertion: assertion_bt_enable

Adding this line in hci_core.c bt_enable() resolves problem with assertion. k_work_queue_init(&bt_workq); assertion_bt_enable_resolv

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (11 by maintainers)

Most upvoted comments

Hi @erwango,

Sorry for late answer, i had other stuff to do meantime. unfortunately no progress from my side. I’ve not been able to reproduce this issue on pure ST’s stack. If i’ll get anything new i’ll inform you asap.

@erwango CONFIG_BT_RECV_BLOCKING=n as the BT_RECV_WORKQ_BT is selected.

About reproducing the issue with pure ST’s ble stack - i’ll try to do it asap, but i’ve other higher priority tasks to do, so it may take some time, until i’ll be back with results.

@carlescufi I’m not able to do that. I have’nt any nordic’s hardware.

@erwango As i wrote this occures randomly, but most frequent this happens for low scan interval and scan window. For parameters passed in my first post this happens relatively often - after max few minutes.