Hi
I am experiencing a Hardfault from time to time and I cannot find the cause. The FAULTSTAT register is 0x00000001 so I do not have a valid fault address. The only real information I have is the exception number (21) which makes sense since this is the UART0 peripheral which is used to communicate with the device during regression testing. Below is an output from my application.
20150414 02:46:51.674 : LOG :[!] Hardfault detected\r\n
20150414 02:46:51.674 : LOG :FAULTSTAT: 0x00000001\r\n
20150414 02:46:51.674 : LOG :No valid bus fault address\r\n
20150414 02:46:51.674 : LOG :Stacked core registers:\r\n
20150414 02:46:51.674 : LOG :R0 = 0x00000004\r\n
20150414 02:46:51.674 : LOG :R1 = 0x80022049\r\n
20150414 02:46:51.674 : LOG :R2 = 0x00000010\r\n
20150414 02:46:51.674 : LOG :R3 = 0x00000000\r\n
20150414 02:46:51.674 : LOG :R12 = 0x0001BBBD\r\n
20150414 02:46:51.690 : LOG :LR = 0xFFFFFFF1\r\n
20150414 02:46:51.690 : LOG :PC = 0x7180F04E\r\n
20150414 02:46:51.690 : LOG :PSR = 0x01000015\r\n
How do I go ahead and debug this kind of problem?
Also, the LR and PC registers make no sense. I have the following code in my startup.s file that is supposed to give me a valid stack pointer both in thread mode and handler mode. Does it seem correct?
FaultISR
TST lr, #4 ; Test for MSP or PSP
ITE EQ
MRSEQ r0, MSP
MRSNE r0, PSP
B mcu_hardfault_handler
MpuISR
TST lr, #4 ; Test for MSP or PSP
ITE EQ
MRSEQ r0, MSP
MRSNE r0, PSP
B mpu_fault_handler
Kind regards, Per