cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 hardfault from random point in code

dinhlx
Associate II

Hi all.

I develop controller for PMSM motor and got a problem as below:

Some time MCU jump to hardfault handler. In debug, I see that it cause from random point (different from time to time), some time it cause from very basic function (such as sinf(), cosf(), delay..), as below

dinhlx_0-1693564942608.png

dinhlx_0-1693566061460.png

disassembly at <signal handler called>() at 0xffffffe9 as below:

"ffffffe9:   Failed to execute MI command:

          -data-disassemble -s 4294967273 -e 4294967413 -- 3

          Error message from debugger back end:

          Cannot access memory at address 0xffffffe8"

 

I also think it may cause from hardware because inverter may generate lot of noise. But whenmeasure noise in power, clock of MCU, it is clean: as below

dinhlx_0-1693579899408.png

dinhlx_1-1693579988094.png

When hardfault about to occur, the debug connection on cube monitor corrupt many time

So, where I can check for this issue?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

Hello @dinhlx,

Could you check the fault analyzer window?

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

6 REPLIES 6
FBL
ST Employee

Hello @dinhlx,

Could you check the fault analyzer window?

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

SofLit
ST Employee

Hello,

Since you're running a motor, with random points of hardfault, are you sure you're not facing any EMC issues?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
dinhlx
Associate II

Thank F.Belaid for reply.

I will check and revert to you when have result.

thank SofLit. I also worry about EMI/EMC, so I measure voltage to check and result as mention above. Voltage very clean. with this voltage, can I conclude that isn't EMC issue?

 

Hello,

I'm not an expert of EMC/EMI topics but from what you have described and the randomness behavior, it looks like an EMI/EMC or HW issue. If you disconnect the motor, does the HF happen again?

For your power supply it can be some spikes not seen by a simple run.. Use scope triggers to detect them..

Check your grounds.. your connections your shielding, isolation etc..

You can also refer to this application note.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

For a custom board make sure the VCAP pins and capacitors are correct and placed close to the MCU. Check the voltage.

Double check FLASH configuration, especially wait-states.

Faults probably coming from interrupt / callback code. Make sure you're not overwriting the stack via auto/local variables or arrays out-of-bounds.

The 0xFFFFFFE9 is a magic call-gate address used by the MCU to unstack context related to interrupts/handlers. Not going to see code there.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..