Hard fault exception state in Ozone j- link debugger

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Rakesh_rp
Level 3
Level 3
First solution authored 10 replies posted 10 questions asked

I am working on power factor correction   code  using xmc1404 development board  .  I am using total  4 timer ISR and one SYSTIC ISR.  for current control I am using 30khz ISR , for voltage control I am using software manually controlled ISR.  the supervisory control is implemented in SYSTIC ISR of 1ms. while debugging I faced Hard fault exception state in Ozone j-link debugger . This issue occurs only when I run the code present in  voltage control ISR and current control ISR.

0 Likes
1 Solution
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Rakesh,

I got confused it was an XMC4000 part. For XMC1000- cortex m0 family,

When your system is hung up, the first step is to detect the cause for the hang up. To detect the cause for system hang up, first execute your program in debugging mode and allow the system to run until the system hangs up again, then halt the debugger. There are two ways to determine whether the hang up is due to the hard fault. The first is to watch the Program Counter (PC) register. If this is a hard fault, the PC register will indicate operation in the hard fault handler. The second method is to watch the Interrupt Program Status Register (IPSR). A value of 0x3 indicates a hard fault.

this might be helpful to identify the possible causes.

https://www.embedded.com/debugging-hard-faults-in-arm-cortex-m0-based-socs/

Best Regards,
Vasanth

View solution in original post

0 Likes
5 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi,

Can you write a fault handler and see what is causing the issue by checking HFSR,MEMFSR, BFSR registers.

Meanwhile this appnote could be also helpful.

https://www.keil.com/appnotes/files/apnt209.pdf

 

Best Regards,
Vasanth

0 Likes

In debug window   HFSR,MEMFSR, BFSR registers where not found . I am using XMC1404, ARM cortex M0 . The SCB contains following registers

Rakesh_rp_0-1642151035928.png

 

The values in SHCSR and CCR register  when hard fault exception state occurs is given below

Rakesh_rp_1-1642151211489.png

 

 

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Rakesh,

I got confused it was an XMC4000 part. For XMC1000- cortex m0 family,

When your system is hung up, the first step is to detect the cause for the hang up. To detect the cause for system hang up, first execute your program in debugging mode and allow the system to run until the system hangs up again, then halt the debugger. There are two ways to determine whether the hang up is due to the hard fault. The first is to watch the Program Counter (PC) register. If this is a hard fault, the PC register will indicate operation in the hard fault handler. The second method is to watch the Interrupt Program Status Register (IPSR). A value of 0x3 indicates a hard fault.

this might be helpful to identify the possible causes.

https://www.embedded.com/debugging-hard-faults-in-arm-cortex-m0-based-socs/

Best Regards,
Vasanth

0 Likes

Hi Vasanth ,

The IPSR  has 0x3 value .  I am not able to find the source and  cause of fault .The call stack is not showing which function is causing the fault. The call stack and  disassembly is shown below. 

Rakesh_rp_0-1642415862074.png

 

 

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Rakesh,

In debug mode, if you step over and see at what point the fault is happening. This should give you a clearer picture on what is triggering the fault.

Best Regards,
Vasanth

0 Likes