cancel
Showing results for 
Search instead for 
Did you mean: 

Hard Fault Occurs When Using Live Expression in CubeIDE

Htera.1
Associate II

Good evening,

I’m reaching out to ask if anyone might be familiar with a solution to a hard fault issue we’re currently encountering.

Here is the situation:

We are using a custom-designed board that incorporates an STM32H7 microcontroller and external Flash memory from Winbond. All source code is stored in the external Flash. The code itself is relatively simple and primarily handles UART communication.

While debugging with CubeIDE, we frequently encounter hard faults when using the Live Expression feature. The fault appears to be an alignment error.

The debugger connection is via SWD using ST-Link. Interestingly, when debugging via JTAG using SEGGER’s J-Link, the hard fault does not occur—even when using Live Expression. However, in this case, the console displays a message saying “cannot read register map.”

This leads me to believe that the occurrence of hard faults may be influenced by the debugging interface (SWD vs. JTAG).

I would greatly appreciate it if anyone could share insights into what might be causing hard faults when using Live Expression during debugging. If there are known causes or recommended countermeasures, I would be grateful to learn about them.

Thank you in advance for your support.

Best regards,

4 REPLIES 4
Pavel A.
Super User

How do you see the hard fault in the debugger? Does your program break into debugger or hang?

Could you post a screenshot?

And what is the address and size of the affected live variable?

 

 

MGogr.1
Associate III

It would helpful if you could provide values of following register:

PRINTF("SCB->CFSR = %X\r\n",SCB->CFSR);
PRINTF("SCB->HFSR = %X\r\n",SCB->HFSR);
PRINTF("SCB->DFSR = %X\r\n",SCB->DFSR);
PRINTF("SCB->MMFAR = %X\r\n",SCB->MMFAR);
PRINTF("SCB->BFAR = %X\r\n",SCB->BFAR);

 This would help narrow down the cause of hard fault.

Htera1_0-1758089182284.png

Thank you for checking.
Here are my responses to your three questions:

How do you see the hard fault in the debugger?
Does your program break into debugger or hang?
Could you post a screenshot?

Please refer to the screenshot above.
The program enters a hang state because it remains in the while(1) loop.

What is the address and size of the affected live variable?

We have confirmed that this issue can occur regardless of the address or size of the variable.

Thank you for your response.
I asked the question because I couldn’t understand it even after reviewing the information you provided.