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 !
I recommend to report this issue to Keil Support by creating a corresponding ticket: www2.keil.com/.../silver
If possible attach: - a valid serial number - your project