- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In debug window HFSR,MEMFSR, BFSR registers where not found . I am using XMC1404, ARM cortex M0 . The SCB contains following registers
The values in SHCSR and CCR register when hard fault exception state occurs is given below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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