Hi,
I am getting exception just after configuring MPU and enabling it.
Please check below code and attached debugger screenshot, guide me how to proceed further
Please share application note and example code for MPU diagnostics for MPC5777C (cobra-55)
MPU_0.RGD[0].WORD0.R = 0x40023000; // start address
MPU_0.RGD[0].WORD1.R = 0x40023400; // end address
MPU_0.RGD[0].WORD2.B.M0PE = 1;
MPU_0.RGD[0].WORD2.B.M0SM = 1;
MPU_0.RGD[0].WORD2.B.M0UM = 5;
MPU_0.RGD[1].WORD2.B.M1PE = 1;
MPU_0.RGD[0].WORD2.B.M1SM = 1;
MPU_0.RGD[0].WORD2.B.M1UM = 5;
MPU_0.RGD[1].WORD2.B.M2PE = 1;
MPU_0.RGD[0].WORD2.B.M2SM = 1;
MPU_0.RGD[0].WORD2.B.M2UM = 5;
MPU_0.RGD[1].WORD2.B.M3PE = 1;
MPU_0.RGD[0].WORD2.B.M3SM = 1;
MPU_0.RGD[0].WORD2.B.M3UM = 5;
MPU_0.RGD[0].WORD2.B.M7RE = 1;
MPU_0.RGD[0].WORD2.B.M7WE = 1;
MPU_0.RGD[0].WORD2.B.M6RE = 1;
MPU_0.RGD[0].WORD2.B.M6WE = 1;
MPU_0.RGD[0].WORD2.B.M5RE = 1;
MPU_0.RGD[0].WORD2.B.M5WE = 1;
MPU_0.RGD[0].WORD2.B.M4RE = 1;
MPU_0.RGD[0].WORD2.B.M4WE = 1;
MPU_0.RGD[0].WORD3.B.VLD = 1; // enable descriptor[0]
// enable descriptor[0]
MPU_0.CESR.B.VLD =1;
Hi,
be aware that any access to area which is not covered by MPU descriptor leads to bus error. It is considered as access violation. So, before enabling MPU by this command:
MPU_0.CESR.B.VLD =1;
… make sure that all the memory mapped resources are covered by descriptors.
I do not have an example written directly for MPC5777C but you can take a look at this one:
https://community.nxp.com/docs/DOC-333962
As a first step, a couple of descriptors are used to cover all the memory resources (flash, RAM, peripheral bridges…).
In next step, descriptor covering RAM is changed and next descriptor is used to disable access to part of RAM. Then that RAM is accessed to show that bus error is triggered due to access violation.
Regards,
Lukas