Modem fault handling

If a fault occurs in the modem, the application is notified through the fault handler function that is registered with the Modem library during initialization. This lets the application read the fault reason (in some cases the modem’s program counter) and take the appropriate action.

On initialization (using nrf_modem_lib_init()), the Modem library integration layer registers the nrf_modem_fault_handler() function through the Modem library initialization parameters. The behavior of the nrf_modem_fault_handler() function is controlled with the three following Kconfig options:

Implementing a custom fault handler

If you want to implement a custom fault handler, enable the CONFIG_NRF_MODEM_LIB_ON_FAULT_APPLICATION_SPECIFIC Kconfig option and provide an implementation of the nrf_modem_fault_handler() function, considering the following points:

  • The fault handler is called in an interrupt context.

  • Re-initialization of the Modem library must be done outside of the fault handler.