This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Find root cause for instruction bus error

Hello,

   I’m struggling with a problem and need your help. I have an application where a nrf52840 communicates with another nrf52840 over BLE using nus and some services. But the nrf52840 crashes from time to time (<10 min). After some debugging I enabled the hard fault handler and got this result (different runs):

00> <error> hardfault: HARD FAULT at 0x81200004
00> <error> hardfault:   R0:  0x00000000  R1:  0x81200004  R2:  0x00000000  R3:  0x00000000
00> <error> hardfault:   R12: 0x48A1C000  LR:  0x00032F19  PSR: 0x40000032
00> <error> hardfault: Cause: Instruction bus error.

 

00> <error> hardfault: HARD FAULT at 0x81200004
00> <error> hardfault:   R0:  0x00000000  R1:  0x81200004  R2:  0x00000000  R3:  0x00000000
00> <error> hardfault:   R12: 0x101D0000  LR:  0x00032F19  PSR: 0x40000032
00> <error> hardfault: Cause: Instruction bus error.

 

00> <error> hardfault: HARD FAULT at 0x81200004
00> <error> hardfault:   R0:  0x00000000  R1:  0x81200004  R2:  0x00000000  R3:  0x00000000
00> <error> hardfault:   R12: 0x50B04000  LR:  0x00032F19  PSR: 0x40000032
00> <error> hardfault: Cause: Instruction bus error.

 

But I absolutely don’t understand where this comes from and how to find the expression that causes this error. Do you have any useful hints for me?

thanks and best regards 

Christoph

Parents Reply
  • That's probably because the 'm_cb' variable is defined statically. You could remove the 'static' keyword temporarily. That should allow you to track the variable from the watch window. Alternatively, you could add a check inside the PWM ISR that checks if the pointer is in a valid address range.

    static void irq_handler(NRF_PWM_Type * p_pwm, pwm_control_block_t * p_cb)
    {
       if ("p_cb->handler() invalid")
       {
            __ASM("nop") //<-- place breakpoint here to catch the error before the fault exception is triggered
        }
      ...

Children
Related