MPC5744 Register Protection

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC5744 Register Protection

Jump to solution
3,908 Views
Jamber_H
Contributor III

Hi, 

Some modules, such as MC_ME, can set the Register Protection, as shown in the fig.1, but some other modules, such as CMU_0, can't use this function, and it's soft lock bit not exist, as shown in the fig.2.

Another question, in the Protected Registers list, why different modules have same Base Address? as shown in the fig.3, CMU0 and CMU1 has a same Base Address 0xFBFB0200, is it correct?

 

2021-04-13_151624.png

2021-04-13_151502.png

2021-04-13_152957.png

0 Kudos
Reply
1 Solution
3,836 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

The note is correct.

The base address for all CMUs is 0xFBFB_0000.

f the Base Address is 0xFBFB0000, the SoftLock bit should be 0xFBFB0000+0x3800=0xFBFB3800, but this address is still not accseeable as is shown in fig below. So could you tell me how to calculate the CMUs' Mirror Address, SoftLock Address and HardLock Address?

You calculation is not correct.

You have to take base address of the register: which for 0xFBFB_0200 which is only valid for CMU modules, for other peripherals your base is base address of module.

petervlna_1-1618563997092.png

 

petervlna_0-1618563954927.png

So for soft locking of CMU0_ CSR register you will do write to 0xFBFB_2200.

And lock register you will see at address 0xFBFB_3880 for CMU0_CSR.

Best regards,

Peter

 

View solution in original post

0 Kudos
Reply
10 Replies
3,832 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

To make it easy, here are macros which can be used for configuring register protection.

/*PowerPC*/

/*-----------------------------------------------------------------------------------------------------------*/
#define REGPROTPPMIRROR 0x2000
#define REGPROTPPSLBR 0x3800
#define REGPROTPPGCR 0x3FFC

#define WRITE_WITH_LOCK_PP_8BIT(registeraddress, value)   
#define WRITE_WITH_LOCK_PP_16BIT(registeraddress, value)   
#define WRITE_WITH_LOCK_PP_32BIT(registeraddress, value)   

#define GET_SOFTLOCK_PP(modulebaseaddress, registeraddress, value)
#define CLR_SOFTLOCK_PP_32BIT(modulebaseaddress, registeraddress)
#define CLR_SOFTLOCK_PP_16BIT(modulebaseaddress, registeraddress)
#define CLR_SOFTLOCK_PP_8BIT(modulebaseaddress, registeraddress)

#define SET_SOFTLOCK_PP_32BIT(modulebaseaddress, registeraddress)
#define SET_SOFTLOCK_PP_16BIT(modulebaseaddress, registeraddress)
#define SET_SOFTLOCK_PP_8BIT(modulebaseaddress, registeraddress)

#define SET_HARDLOCK_PP(modulebaseaddress)
#define USER_ACCESS_FORBIDDEN_PP(modulebaseaddress)
#define USER_ACCESS_ALLOWED_PP(modulebaseaddress)

 And usecase example:

 //16k - 32 bit,CAN1

CAN_6.MCR.B.MDIS = 0x0;
WRITE_WITH_LOCK_16K_32BIT((&CAN_6.MCR.R), 0xD890000F);
GET_SOFTLOCK_16K(&CAN_6, &CAN_6.MCR.R,&testik);
CAN_6.MCR.B.MDIS = 0x0;
CLR_SOFTLOCK_16K_32BIT(&CAN_6, &CAN_6.MCR.R);
GET_SOFTLOCK_16K(&CAN_6, &CAN_6.MCR.R,&testik);
CAN_6.MCR.B.MDIS = 0x0;
SET_SOFTLOCK_16K_32BIT(&CAN_6, &CAN_6.MCR.R);
GET_SOFTLOCK_16K(&CAN_6, &CAN_6.MCR.R,&testik);

//SET_HARDLOCK_16k(&CAN_6);
CLR_SOFTLOCK_16K_32BIT(&CAN_6, &CAN_6.MCR.R);
GET_SOFTLOCK_16K(&CAN_6, &CAN_6.MCR.R,&testik);

CAN_6.MCR.B.MDIS = 0x1;
USER_ACCESS_FORBIDDEN_16k(&CAN_6);
GET_GCR_16K(&CAN_6,&GCRvalue);
CAN_6.MCR.B.MDIS = 0x0;
USER_ACCESS_ALLOWED_16k(&CAN_6);
GET_GCR_16K(&CAN_6,&GCRvalue);
CAN_6.MCR.B.MDIS = 0x0;

SET_HARDLOCK_16k(&CAN_6);
GET_GCR_16K(&CAN_6,&GCRvalue);
0 Kudos
Reply
3,828 Views
Jamber_H
Contributor III

Hi Peter,

Thank you for your reply. Now I know what the NOTE means, which is a keypoint, and I have had a test, it works well.

Best regards

Jamber

0 Kudos
Reply
3,874 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Only registers listed in appendix A can be locked by register protection:

petervlna_0-1618472142468.png

So not all registers in module support this feature. Usually its only safety relevant.

Another question, in the Protected Registers list, why different modules have same Base Address? as shown in the fig.3, CMU0 and CMU1 has a same Base Address 0xFBFB0200, is it correct?

Well, that is copy paste typo in manual, please have a look at manual Addendum instead:

Here are the addresses:

#define CMU_0 (*(volatile struct CMU_tag *) 0xFBFB0200UL)
#define CMU_1 (*(volatile struct CMU_tag *) 0xFBFB0240UL)
#define CMU_2 (*(volatile struct CMU_tag *) 0xFBFB0280UL)
#define CMU_3 (*(volatile struct CMU_tag *) 0xFBFB02C0UL)
#define CMU_4 (*(volatile struct CMU_tag *) 0xFBFB0300UL)

petervlna_1-1618472584102.png

Best regards,

Peter

0 Kudos
Reply
3,868 Views
Jamber_H
Contributor III

Hi Peter,

I think I find the answer, but I don't understand. Thanks for your screenshot I saw the NOTE and it said " All CMUs modules are in the same protected region with the base address aligned to the 16k - 0xFBFB_0000", what's the meaning of this?

If the Base Address is 0xFBFB0000, the SoftLock bit should be 0xFBFB0000+0x3800=0xFBFB3800, but this address is still not accseeable as is shown in fig below. So could you tell me how to calculate the CMUs' Mirror Address, SoftLock Address and HardLock Address?

It's so funny different with other modules.

2021-04-15_164430.png

2021-04-15_164141.png

Best regards

Jamber

 

0 Kudos
Reply
3,837 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

The note is correct.

The base address for all CMUs is 0xFBFB_0000.

f the Base Address is 0xFBFB0000, the SoftLock bit should be 0xFBFB0000+0x3800=0xFBFB3800, but this address is still not accseeable as is shown in fig below. So could you tell me how to calculate the CMUs' Mirror Address, SoftLock Address and HardLock Address?

You calculation is not correct.

You have to take base address of the register: which for 0xFBFB_0200 which is only valid for CMU modules, for other peripherals your base is base address of module.

petervlna_1-1618563997092.png

 

petervlna_0-1618563954927.png

So for soft locking of CMU0_ CSR register you will do write to 0xFBFB_2200.

And lock register you will see at address 0xFBFB_3880 for CMU0_CSR.

Best regards,

Peter

 

0 Kudos
Reply
3,827 Views
Jamber_H
Contributor III

Hi Peter,

I think it's better understand if modified the value of "Offset" of CMU in Table2-77 to 0x200, 0x208, 0x20C, et.al. but now I get it anyway, thank you.

2021-04-16_184156.png

Best Regards

Jamber

 

0 Kudos
Reply
3,871 Views
Jamber_H
Contributor III

Hi Peter, 

Thank you for your reply.

"Only registers listed in appendix A can be locked by register protection:", what confused me is the CMU0 module is right in the Appendix A, but I can't access its SoftLock bit, and I post the screenshot in my question.

Best Regards,

Jamber

0 Kudos
Reply
3,863 Views
petervlna
NXP TechSupport
NXP TechSupport

Hmm strange,

I was not aware of this. Trying to think about how to calculate the address.

Let me test it here and I will come back to you ASAP.

best regards,

Peter

0 Kudos
Reply
3,890 Views
Jamber_H
Contributor III

Could someone help me please?

0 Kudos
Reply
3,897 Views
Jamber_H
Contributor III

I Test MC_ME, CMU, ADC, CTU, PWM, only CMU is failed to set softlock, other modules can set softlock succussfully. Why?

0 Kudos
Reply