nRF52833 ends up in HardFault_Hanlder after enabling SPIM

Greetings,

I'm bringing up a new 52833 board that may or may not have hardware wiring and/or power delivery issues.

I'm able to attach Segger debugger via SWD and execute simple code, but the moment I try to get off the chip the debugger always shows up in HardFault_Handler.

I read through the various online guides on what all causes hard faults on ARM M4, and I'm still not able to get at the root cause.

Reverting to a very simple example, let's say I try to send out a SPI command, the hard fault occurs when I step over the NRFX_IRQ_ENABLE at nrfx_spim.c line 334.

A breakpoint inside the actual IRQ handler never gets reached.

Any suggestions?

Thanks!

Dan

Parents
  • Hi Dan,

    Is it the same behavior with any sample (using peripheral other than SPIM)? What is the info given by the hardfault_handler? Normally hardfault_handlers throw out some debuggiing information regarding the nature of the hardfault. Also, which SDK are you using? from the sound of it, it seems older nRF5SDK and not nRF Connect SDK.

  • Thanks Susheel,

    I believe I'm using the next-to-latest SDK: tried latest version 17 where none of the examples would compile, reverted to latest version 16 and remained on that one.

    The HardFault_Handler code I have at the moment is what comes with Cortex_M_Startup.s that gets dropped in with a "New Project". I suppose the relevant code snippet is:

    HardFault_Handler:
            //
            // Check if HardFault is caused by BKPT instruction
            //
            ldr     R1, =0xE000ED2C         // Load NVIC_HFSR
            ldr     R2, [R1]
            cmp     R2, #0                  // Check NVIC_HFSR[31]
    
    L(hfLoop):
            bmi     L(hfLoop)               // Not set? Stay in HardFault Handler.

    where it stays in hfLoop.

    Is there a different handler code available that walks through the logic of what caused the fault in the first place? I tried looking at the registers and can't wrap my head around it.

    Thanks!

    Dan

  • Is it possible that you have attempted to port your project to the later release and might be some of the API changes are incompatible with your modifications?

    Can you attach your project, I can quickly give it a try and try to figure out what triggers this hardfault.

Reply Children
Related