Hard fault in nrf_log_frontend_dequeue CRITICAL_REGION_EXIT

I've been trying to debug a recurring hard fault around nrf_log_frontend_dequeue. This occurs sporadically (between 10-60min) into testing my firmware. When the fault occurs, my call stack looks like:

led_on_for_a_little() which is a non-blocking function that flashes an indicator LED and is called after sd_ble_gatts_hvx() in custom service measurement transmit function

CRITICAL_REGION_EXIT() in nrf_log_frontend_dequeue() in nrf_log_frontend.c

The hard fault handler returns the following:

<error> hardfault: HARD FAULT at 0xFF025402
<error> hardfault: R0: 0x00000000 R1: 0x0000000C R2: 0x40


I am not really sure how to debug this, so any insight would be greatly appreciated, thanks in advance!

  • Hi,

    I see you already have another thread about this, but that there has not been much development there lately. I notice that the The program counter (PC) address here is way out (0xFF025402), and that is also the case in the other thread but with a completely different address. So it seems like maybe you are seeing a form of overflow or other memory related issue that causes execution of some more or less random addresses.

    Do you by any chance call NRF_LOG_PROCESS() from several places, for instance in  your main loop and in an interrupt?

Related