Skip to main content
Associate III
March 6, 2024
Solved

[STM32H7] When I set the MPU at the address 0x30000000,Program entry HardFault

  • March 6, 2024
  • 8 replies
  • 4052 views

The configuration of Cubemx is as follows

001.jpg

The configured address is the address of SRAM1-3,given this configuration, why does "Strongly ordered memory" cause a HardFault

 

Thanks.

 

This topic has been closed for replies.
Best answer by mƎALLEm

I don't know about LWIP, but you can check if you faced an unaligned access in your application by reading SCB_CFSR register:

If SCB_CFSR = 0x01000000 -> you have an unaligned access.

For your reference: https://developer.arm.com/documentation/dui0646/c/Cortex-M7-Peripherals/System-control-block/Configurable-Fault-Status-Register?lang=en#Cihgbdbi

8 replies

PasserbyAuthor
Associate III
March 6, 2024

Is it because the address of sram1-3 cannot be "Strongly ordered"?

Why?

ST Employee
March 6, 2024

Hello @Passerby, welcome to ST Community, 

You can find below the MPU configuration for region0- this photo is from Managing memory protection unit in STM32 MCUs - Application note

SarraS_0-1709715716605.png

 So in STM32CubeMX, the MPU shareability must be enabled for example, please refer to How to configure the MPU of an STM32 using STM32CubeMX.

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.
PasserbyAuthor
Associate III
March 6, 2024

Hello,@Sarra.S

But it works when I set it to "TEX = 1   C = 0  B = 0  S = 0", shareability is disable,Why?

When I set it to  "TEX = 0   C = 0  B = 0  S = 1",it is cannot work。

 

Thanks.

mƎALLEm
ST Technical Moderator
March 6, 2024

Hello,

Are you doing an Unaligned access to that memory region?

See: https://www.keil.com/support/docs/3777%20%20.htm

From ARM CM7 TRM:

SofLit_0-1709718701529.png

 

 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
PasserbyAuthor
Associate III
March 6, 2024

Hello @mƎALLEm 

I use CubeMX ETH LWIP(LAN8742)  default settings ,does this result in unaligned access?The MPU is as I configured it.

I use cubemx 6.8.0 ,HAL FW_H7 v1.11.1

 

 

Thanks!

 

mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
March 6, 2024

I don't know about LWIP, but you can check if you faced an unaligned access in your application by reading SCB_CFSR register:

If SCB_CFSR = 0x01000000 -> you have an unaligned access.

For your reference: https://developer.arm.com/documentation/dui0646/c/Cortex-M7-Peripherals/System-control-block/Configurable-Fault-Status-Register?lang=en#Cihgbdbi

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