Skip to main content
Hoang_Tran
Associate III
August 4, 2022
Question

Can't modify SCB register and Ethernet hard fault

  • August 4, 2022
  • 1 reply
  • 678 views

Hi All,

I'm using STM32H743ZI2 Nucleo board to connect to internet but I have a hard fault error.

I'm try enable MMARVAILD bit in SCB->CFSR to hold valid fault address (SCB->CFSR |= (0X1UL<<7);) but it's still 0 after set command.

Please help me to check error

 MPU_InitStruct.Enable = MPU_REGION_ENABLE;
 MPU_InitStruct.Number = MPU_REGION_NUMBER0;
 MPU_InitStruct.BaseAddress = 0x0;
 MPU_InitStruct.Size = MPU_REGION_SIZE_4GB;
 MPU_InitStruct.SubRegionDisable = 0x87;
 MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
 MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS;
 MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
 MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
 MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
 MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
 
 HAL_MPU_ConfigRegion(&MPU_InitStruct);
 
 /** Initializes and configures the Region and the memory to be protected
 */
 MPU_InitStruct.Number = MPU_REGION_NUMBER1;
 MPU_InitStruct.BaseAddress = 0x30000000;
 MPU_InitStruct.Size = MPU_REGION_SIZE_1KB;
 MPU_InitStruct.SubRegionDisable = 0x0;
 MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
 MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
 MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
 MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;
 
 HAL_MPU_ConfigRegion(&MPU_InitStruct);
 
 /** Initializes and configures the Region and the memory to be protected
 */
 MPU_InitStruct.Number = MPU_REGION_NUMBER2;
 MPU_InitStruct.BaseAddress = 0x30000400;
 MPU_InitStruct.Size = MPU_REGION_SIZE_32KB;
 
 HAL_MPU_ConfigRegion(&MPU_InitStruct);
 /* Enables the MPU */
 HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);

linker file

 .lwip_sec (NOLOAD) : {
 . = ABSOLUTE(0x30000000);
 *(.RxDecripSection) 
 
 . = ABSOLUTE(0x30000200);
 *(.TxDecripSection)
 
 . = ABSOLUTE(0x30004000);
 *(.Rx_PoolSection) 
 } >RAM_D2

error: 0693W00000QMvbCQAT.pngLWIP config 0693W00000QMvc0QAD.png

This topic has been closed for replies.

1 reply

Pavel A.
Super User
August 4, 2022

Use the hard fault analyzer tool in CubeIDE, it will show you all available details.

> I'm try enable MMARVAILD bit in SCB->CFSR to hold valid fault address

This bit is read only,