HardFault in SoftDevice @ 0x20B55

Hi

I have a hardfault which was triggered at address 0x20B55. The memory region from the SoftDevice is from 0x1000 – 0x26633.

Can you tell me what is the root cause of this HardFault? I have no access to this region because its inside of the softdevice.

I found this, but the I don't know the root cause to fix the problem asap.

HardFault Status Register (HFSR) - 0xE000ED2C

This registers explains the reason a HardFault exception was triggered.

There’s not too much information in this register but we will go over the fields real quickly

  • DEBUGEVT- Indicates that a debug event (i.e executing a breakpoint instruction) occurred while the debug subsystem was not enabled
  • FORCED- This means a configurable fault (i.e. the fault types we discussed in previous sections) was escalated to a HardFault, either because the configurable fault handler was not enabled or a fault occurred within the handler.
  • VECTTBL- Indicates a fault occurred because of an issue reading from an address in the vector table. This is pretty atypical but could happen if there is a bad address in the vector table and an unexpected interrupt fires.

Parents Reply Children
  • nRF5 SDK v17.1.0 with s140_nrf52_7.2.0_softdevice.hex

  • Hi,

    The address does not seem to correspond to any softdevice assert.

    1) Do you have any logs? or call-stack info that shows this fault?

    2) Was app_error_fault_handler() called?

    3) Make sure that the hardfault library is used.

    Add these to your projects:

    $(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c
    $(SDK_ROOT)/components/libraries/hardfault/nrf52/handler/hardfault_handler_gcc.c 

    And set HARDFAULT_HANDLER_ENABLED to 1 in sdk_config.h, and add DEBUG_NRF in your preprocessor definitions

  • 1) Unfurtenatly we have no debugger connected

    The hardfault handler is enabled.

    #define HARDFAULT_HANDLER_ENABLED 1

    The call is from this code:

    void HardFault_Handler(void)
    {
    	uint32_t* sp = (uint32_t*) __get_MSP();  // Get stack pointer
    	uint32_t ia = sp[12]; // Get instruction address from stack
    	m_hardfault_type = hardfault_hardfault;
    	m_hardfault_address = ia;
    	printf("Hard Faults at address: 0x%08x\r\n", (unsigned int)ia);
    	hal_ext_uart_buffer_flush();    // print out all bytes
    
    	while (1)
    		;
    }
    

    I will try to get some more detialed information about the hardfault

  • We got additional information about an occured HardFault right now, maybe you can help us to clarify the root cause of this:

    CFSR Bit 17 ->  [17] = "The processor has attempted to execute an instruction that makes illegal use of the EPSR",

    HFSR Bit 30 ->   FORCED - This means a configurable fault (i.e. the fault types we discussed in previous sections) was escalated to a HardFault, either because the configurable fault handler was not enabled or a fault occurred within the handler.

    We are working with the SoftDevice 7.2.0 S140, the 7.3.0 is available, could this be a try to upadte or what do you guess?

    Thank you

  • Dominik Eugster said:
    We are working with the SoftDevice 7.2.0 S140, the 7.3.0 is available, could this be a try to upadte or what do you guess?

    No, I don't think SD version have something to do with this.

    Dominik Eugster said:

    Most common way to get a hardfault when calling a sd_ function, is that it's called from a context that is in a too high interrupt priority level. So you should try lowering the interrupt priority for the context you are calling sd_ble_gatts_value_set() from.

Related