Skip to main content
LBhat.1
Associate
April 13, 2021
Question

STM32 MPU Hard Fault

  • April 13, 2021
  • 2 replies
  • 704 views

I am using STM32F429zi micro and MPU (Memory Protection Unit) module. When I individually protect blocks it's working but when I enable complete background region protection it's throwing hard fault.

static void protectBackgroundRegion(void)
{
 // Configure Region 0 to catch invalid pointer references
 MPU->RNR = mpuBackgroundRegion;
 MPU->RBAR = 0x00000000UL; //0x0800C000UL; //
 MPU->RASR =
 MPU_NO_EXECUTABLE |
 (mpuRegion_NoAccess << MPU_RASR_AP_Pos) |
 (0 << MPU_RASR_TEX_Pos) |
 MPU_CACHEABLE |
 MPU_SHAREABLE |
 (0 << MPU_RASR_SRD_Pos) |
 (mpuRegionSize4Gb << MPU_RASR_SIZE_Pos) |
 (1 << MPU_RASR_ENABLE_Pos);
}
 

This topic has been closed for replies.

2 replies

Pavel A.
Super User
April 13, 2021

So maybe you forget some other region that should be let alone (core registers... ) What are your other regions? What address causes the fault?

LBhat.1
LBhat.1Author
Associate
June 21, 2021

0693W00000BbazwQAB.pngThanks Pavel for responding, attached is screenshot when it hits fault. I hope it helps.