Keil Logo

Forced Hard Fault / Bus Fault debugging Cortex M4

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Author
Pierre Bogrand
Posted
11-Apr-2019 15:28 GMT
Toolset
ARM
New! Forced Hard Fault / Bus Fault debugging Cortex M4

Hi,

I am working on a software development on a nRF52832 chip from Nordic, embedding a Cortex M4. I am using Keil µVision5.
Amongst other things, the nRF52832 communicates via UART with a GSM chip. This GSM chip sends data packets of a certain size, to the nRF52832 every 100ms (or more, doesn't change anything).
If those packets contain 100 or less bytes of data, everything works fine. But if those packets contain more than 100 bytes (my final objective being 127 bytes data packets for backend reasons), when the second packet is received by the nRF52832 chip, it goes into HardFault_Handler in the arm_startup_nrf52.s startup file :

HardFault_Handler\ 
                PROC
                EXPORT  HardFault_Handler         [WEAK]
                B       .
                ENDP

When debugging, I put a breakpoint when the code enters this HardFault_Handler and checked the Faults Reports (SCB register):

SCB->CFSR = 0x00008200

MMFSR = 0x00 (no flag or error) BFSR = 0x82 (PRECISERR and BFARVALID flags) UFSR = 0x0000 (no flag or error)

SCB->HFSR = 0x4000000 (FORCES flag)
SCB->DFSR = 0x0000002 (BKPT flag)
SCB->AFSR = 0

So it seems that the Hard Fault was forced by what was in fact a Bus Fault. But I can't make sense of the address specified in the BFAR register (SCB->BFAR = 0x0002607F) as the fault origin:

...
0x00026063 AF00      ADD           r7,sp,#0x00
0x00026065 0264      LSLS          r4,r4,#9
0x00026067 AF00      ADD           r7,sp,#0x00
0x00026069 0264      LSLS          r4,r4,#9
0x0002606B AF00      ADD           r7,sp,#0x00
0x0002606D 0264      LSLS          r4,r4,#9
0x0002606F AF00      ADD           r7,sp,#0x00
0x00026071 0264      LSLS          r4,r4,#9
0x00026073 AF00      ADD           r7,sp,#0x00
0x00026075 0264      LSLS          r4,r4,#9
0x00026077 AF00      ADD           r7,sp,#0x00
0x00026079 0264      LSLS          r4,r4,#9
0x0002607B FF00FFFF  DCD           0xFFFFFF00
0x0002607F FFFFFFFF  DCD           0xFFFFFFFF   //BFAR
0x00026083 FFFFFFFF  DCD           0xFFFFFFFF
...

Thank you for any help on the subject !

Author
R. Kopsch
Posted
17-Apr-2019 13:38 GMT
Toolset
ARM
New! RE: Forced Hard Fault / Bus Fault debugging Cortex M4

I recommend to report this issue to Keil Support by creating a corresponding ticket: http://www2.keil.com/support/silver

If possible attach:
- a valid serial number
- your project

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.