2025-06-25 7:49 PM
Hello everyone, I am using the LWIP protocol stack on an STM32H743.
I'm a bit confused about the MPU configuration here.
I currently have the DMA receive and transmit descriptor addresses set to 0x30040000 and 0x30040100 respectively.
The DMA receive buffer (RxBuff) address is set to 0x30040200.
My configuration is as follows:
HAL_MPU_Disable();
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.BaseAddress = 0x30040000;
MPU_InitStruct.Size = MPU_REGION_SIZE_512B;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER5;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.SubRegionDisable = 0x00;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.BaseAddress = 0x30040200;
MPU_InitStruct.Size = MPU_REGION_SIZE_16KB;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER6;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL1;
MPU_InitStruct.SubRegionDisable = 0x00;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
The first descriptor configuration at 0x30040000 works without issues.
But after adding the configuration for 0x30040200, I encounter reception problems – specifically DMA transmit timeouts where the OWN bit in the descriptor doesn't change.
Could you please explain why?
2025-06-26 3:45 AM
1. Base address of a MPU region must be aligned on the region size, so the definition of your region #6 is invalid (lines 17-18)
2. Setting ETH descriptors and buffers as executable has no sense (and probably can involve weird issues related to so called "speculative execution")
3. Remove HAL_MPU_Enable() in line 14. Enable MPU only after configuring the last region.
Maybe there are more issues...