Skip to main content
june
Associate III
April 6, 2022
Solved

[H723] I want to know why it becomes a hard fault

  • April 6, 2022
  • 2 replies
  • 2660 views

H723ZGT6 Nucleo-144

CubeMX 6.3.0

AN209, Summer 2017, V 5.0

An error occurred when writing a for loop process before SDRAM initialization.

I know the solution, but I don't know why this is happening.

(Add static or volatile or write a for loop after SDRAM initialization

Then the problem can be solved)

​

​

0693W00000Lx4MxQAJ.png[AN209, Summer 2017, V 5.0]

Using Cortex-M3/M4/M7 Fault Exceptions

​

I found this manual with details of hard faults.

About UNALIGNED

"There was an unaligned memory access," he said.

What is the relationship between SDRAM initialization and for loops?

Why do I get a hard fault error if I write a for loop before SDRAM initialization?

If anyone knows please let me know.

​

This topic has been closed for replies.
Best answer by Tesla DeLorean

Look at what's actually faulting.

Have a proper Hard Fault handler that can quickly/effectively report detail about the point of failure.

Look at the disassembly of the code prior to the fault.

​

L​ikely got a LDRD or STRD against a pointer that isn't on a 32-bit boundary, and the compiler has optimized inappropriately.

2 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
April 6, 2022

Look at what's actually faulting.

Have a proper Hard Fault handler that can quickly/effectively report detail about the point of failure.

Look at the disassembly of the code prior to the fault.

​

L​ikely got a LDRD or STRD against a pointer that isn't on a 32-bit boundary, and the compiler has optimized inappropriately.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
june
juneAuthor
Associate III
April 11, 2022

When I checked, it seemed that a strange address was being called.

Thanks for your help

0693W00000LxW76QAF.png