cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 MPU Hard Fault

LBhat.1
Associate

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);
}
 

2 REPLIES 2
Pavel A.
Evangelist III

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
Associate

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