ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:374 k_sem_take failed with err -11

I use NRF52832 as a Bluetooth gateway to receive commands and initiate connections to devices. Each instruction received will be interrupted through the IO pin, and the MAC data of the connected device will be transmitted to nrf52832 through SPI. After receiving multiple commands, Bluetooth will display err=k_sem_take (&sync_dem, HCI-CMD_TIMEOUT);

BT_ASSERT_MSG(err == 0, "k_sem_take failed with err %d", err);

err = k_sem_take(&sync_sem, HCI_CMD_TIMEOUT);
BT_ASSERT_MSG(err == 0, "k_sem_take failed with err %d", err);

What does this error mean?
How to solve it?

Parents
  • Hello,

    Are you running the HCI SPI sample on the nRF52832? If so, which Bluetooth host are you using?

    Thanks,

    Vidar

  • Hello ,  Thank you very much for your reply.


    The SPI used by nrf52832 is based on the nrfx library SPIM.


    Nrf52832 receives IO port interrupt pins, receives information about connected devices through SPIM, initiates a connection to the device during scanning, and executes a stop scan function before initiating the connection. Every time I connect, I subscribe to the corresponding attribute, and once the subscription is successful, I force the device to disconnect.

    After successfully connecting to 4 devices and subscribing to data, I performed this operation on the last device by sending the command ->Subscription Successful ->Force Disconnect. I repeated this operation and conducted a stress test. I found that at a certain point, when SPIM received device information and initiated a disconnection scan before connection, the system would display the HCI command semaphore acquisition timeout of 10 seconds, causing the system to restart.

    In normal use, there may be occasional restarts after sending data to the 32 chip through interrupts. The phenomenon of restarting is that the waiting time for this signal exceeds 10 seconds.

    Do you have any methods or ideas for finding problems?

  • Hi,

    Thanks for the additional information. This assert is raised if the controller fails to respond to a HCI command. It could be that it was blocked by other higher priority tasks or interrupts. Are you calling any Bluetooth or other potentially blocking functions from the SPIM interrupt handler, and are you using the Zephyr or nRFx driver?  

    Would you be able to share revelevant parts of your code here or in a private support ticket?

    Thanks,

    Vidar

Reply
  • Hi,

    Thanks for the additional information. This assert is raised if the controller fails to respond to a HCI command. It could be that it was blocked by other higher priority tasks or interrupts. Are you calling any Bluetooth or other potentially blocking functions from the SPIM interrupt handler, and are you using the Zephyr or nRFx driver?  

    Would you be able to share revelevant parts of your code here or in a private support ticket?

    Thanks,

    Vidar

Children
No Data
Related