How to Use NMPU
468
SPNU563A – March 2018
Copyright © 2018, Texas Instruments Incorporated
System Memory Protection Unit (NMPU)
7. Program the MPUREGSENA register (
) to set the size, and enable MPU region number
indicated by step 5 above. Notice that this is not yet enabling the NMPU module.
8. Program the MPUREGACR register (
) to set access permission for user or privilege
mode.
9. Repeat steps 5 to 8 for the remaining MPU regions available for the particular NMPU instance.
10. Write 0xA to MPUENA field of MPUCTRL1 register (
) to enable NMPU to start access
permission check.
11. Write 0x5 to unlocked key field LOCK of MPULOCK register (
) to avoid unintentional
write to NMPU configuration registers.
12. Enable bus master to start transaction. Please follow the bus master TRM on how to start the bus
interface. it will be different from one bus master to another.
During application run time, if the NMPU detects a memory access violation or the functional fail safe logic
detects a lock step compare error, you will be interrupted. Refer to TRM to find out which ESM group and
channel the NMPU or bus master error event is mapped (based on step 3 above) and which VIM channel
the ESM interrupt output is mapped.
Following is the recommended generic software sequence to find out what causes MPU error:
1. Read the MPUERRSTAT register:
•
If RERR (read error), WERR (write error), BGERR (background error), or APERR (access
permission error) is set and ERRFLAG is also set, this indicates that the bus master tries to access
the address location that violates the memory protection setting. This can happen due to software
bug, transient fault, or permanent fault.
•
If DIAGERR (safety diagnostic error) bit is set and ERRFLAG is also set, this indicates that the
1oo1D diagnostic architect for input address masking, address translation, or mode translation has
detected an error. This can happen due to transient fault or permanent fault.
2. You can further read additional information from REGION, MASTERID, or ERRFLAG bit fields of
MPUERRSTAT register and MPUERRADDR register to narrow down the causes.
3. In fault case, it is up to end application to decide on whether to bring the system to safe state or ignore
NMPU error or try to recover by retrying transaction if master is able to support it. If bus master does
not support retry of a particular transaction, use can halt bus master, starts NMPU internal diagnostic
(see
). Assume diagnostic result passes, you can restart bus master operation. If the
recover attempt still fails, you can decide to bring the system to safe state.
11.3.2 How to Use Diagnostics
Diagnostic mode can be used to verify the MPU address and access permission comparator logic working
properly at either start up time or during application run time with/without error encountered. This is
achieved by internal or external diagnostic mode. Entering or exiting the diagnostic mode will automatically
clear the MPUERRSTAT (
) and MPUERRADDR (
) registers. It is
recommended that you back up the values of MPUERRSTAT (
) and MPUERRADDR
(
) registers to system RAM prior to start diagnostic during run time.
Another diagnostic mode of NMPU is for functional fail safe diagnostic. Features like input address
masking, address translation and mode translation are integrated along with a critical function like memory
protection, thus NMPU needs to have the hardware logic for run-time diagnostics. This logic is
implemented using 1oo1D safety architecture.