HCI: handling error

Hi!
I am developing project based on nrf9160 as a main processor and nrf52840 as a hci controller.
I am using nrf connect sdk 2.6.1.

I came across a potential issue in nrf connect sdk.

If bt_hci_cmd_send_sync() reaches timeout waiting for controller (HCI_CMD_TIMEOUT), BT_ASSERT_MSG in file hci_core.c, line 331 is activated.
This causes a processor hard fault condition, which is not a tolerable behaviour in the project I am working on. I'd like error to be returned and handled by the application.
I managed to disable hard fault functionality the condition by setting:

CONFIG_BT_ASSERT=n

There are two further issues though:
1. If BT_ASSERT is disabled, error from k_sem_take() is completely ignored, and function returns 0.
2. I saw that in newer zephyr version there are more and more calls to BT_ASSERT_MSG and BT_ASSERT, so I am not sure whether disabling it is safe.

Thank you for your help and time in advance.

KR,
Piotr
Parents Reply Children
  • I am working on iot device which consists of nrf91 as a main processor and handles communication with server.
    Nrf52840 is used as a bluetooth controller. 

    In general I am aware of the mechanism. Normally I don't experience the error.

    However I'd like my firmware to handle situation in which for example nrf52840 gets damaged, there is a cold joint, etc..

    In situation like this I expect the program ran on nrf91 to handle the exception (HCI_TIMEOUT) and report the error to cloud.

    Current mechanism implemented in the sdk doesn't allow me to do so.

    KR,
    Piotr

Related