2023-06-07 02:11 AM
Affected driver library: STM32Cube_FW_U5_V1.2.0
File: stm32u5xx_ll_cortex.h
Functions affected: LL_MPU_ConfigRegion, LL_MPU_ConfigRegion_NS
Bug: The Parameter AttrIndx is not shifted to the correct bit Position.
Current (wrong) implementation: "WRITE_REG(MPU->RLAR, ((LimitAddress & MPU_RLAR_LIMIT_Msk) | AttrIndx | MPU_RLAR_EN_Msk));"
Fix: "WRITE_REG(MPU->RLAR, ((LimitAddress & MPU_RLAR_LIMIT_Msk) | (( AttrIndx << MPU_RLAR_AttrIndx_Pos) & MPU_RLAR_AttrIndx_Msk) | MPU_RLAR_EN_Msk));"
By the way: The line "MPU->RBAR |= Attributes;" in function "LL_MPU_ConfigRegion" directly after selecting the region should be removed since it has no benefit. Function "LL_MPU_ConfigRegion_NS" does not even contain this line.