AnsweredAssumed Answered

hard fault caused by BusFault

Question asked by Johannes Bruder on Jan 17, 2020
Latest reply on Jan 28, 2020 by Johannes Bruder

Hi all,

I encounter frequent hard fault as soon I use CAN & USB at the same time. I'm using FreeRTOS  on a MK64F MCU.

I tried to analyze fault registers to find out the cause of the hard fault but I'm not sure to interpret the value of BFAR.

See below the steps when it is stopped in HardFault_Handler function:

 

1. Inspect Configurable Fault Status Registers

 

GDB: print/x *(uint32_t *) 0xE000ED28

 

Entire CFSR    0x008200

 

with [ UFSR | BFSR | MMFSR ]
UFSR           0x0000
BFSR           0x82
MMFSR          0x00

 


2. BusFault Status Register (BFSR) - 0xE000ED29

 

GDB: print/x *(uint8_t *) 0xE000ED29

 

BFSR 0x82

 

-> 0b10000010

 

7: BFARVALID    1
1: PRECISERR    1

 

3. Bus Fault Address Register (BFAR)

 

GDB: print/x *(uint32_t *) 0xE000ED38

 

-> 0x2c80001c

should hold the address which triggered the fault ?

 

See my linker script from SDK:

 

/* Specify the memory areas */
MEMORY
{
  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010
  m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0
  m_data                (RW)  : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
  m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00030000
}

 

I would assume it should point somewhere in m_text region...

 

Any ideas ?  What am I doing wrong ?

 

Register addresses from: https://developer.arm.com/docs/dui0553/b/cortex-m4-peripherals/system-control-block/configurable-fault-status-register#C… 

Outcomes