MPC5645C Shadow Flash programming

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

MPC5645C Shadow Flash programming

775 Views
michel_dasilva
Contributor I

On the MPC5646C, is it useful to program to 0 the bits PAD3V5V[0] and PAD3V5V[1] in NVUSRO register if we are powered 5V ?

Does the GREENHILLS  JTAG probe detect the voltage and automatically changes these bits to 0?

Do you have the code to write this register ?

0 Kudos
1 Reply

667 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

having it set for 3.3V when using a 5V supply will cause higher switching rates for the outputs...leading potentially to worse EMC performance and higher currents. So, output characteristics can be slightly changed but it does not affect rest of the device.

Debuggers don’t change this configuration automatically, it’s responsibility of user.

 

If you want to program the shadow flash by your code, you can use something like this:

 

void ShadowFlashReprogram(void)

{             

                //unlock shadow block

                CFLASH_0.LML.R = 0xA1A11111;                //unlock register

                CFLASH_0.LML.R = 0x000300FF; //unlock shadow flash

               

                CFLASH_0.SLL.R = 0xC3C33333;   //unlock register

                CFLASH_0.SLL.R = 0x000300FF;   //unlock shadow flash

               

               

                /* run this code if double word at address 0xFFFE18 is not in erased state (all 0xFF) */

#if 0      

                //erase shadow flash

                CFLASH_0.MCR.B.ERS = 1;

                *(unsigned int*)0x00FFC000 = 0xFFFFFFFF;          //interlock write - write any address in shadow block

                CFLASH_0.MCR.B.EHV = 1;

                while(CFLASH_0.MCR.B.DONE == 0){};

                CFLASH_0.MCR.B.EHV = 0;

                CFLASH_0.MCR.B.ERS = 0;                           

               

                //program shadow flash (restore default password and censoring information) - if not done, the device will be locked!!!

                CFLASH_0.MCR.B.PGM = 1;         

                //program first 128bit page

                *(unsigned int*)0xFFFDD8 = 0xFEEDFACE;             //write data within 128bit programming page

                *(unsigned int*)0xFFFDDC = 0xCAFEBEEF;             //write data within 128bit programming page

                CFLASH_0.MCR.B.EHV = 1;                                                                           //program page (words that were not written above will have default value 0xFFFF)

                while(CFLASH_0.MCR.B.DONE == 0){};

                CFLASH_0.MCR.B.EHV = 0;

                //program second 128bit page

                *(unsigned int*)0xFFFDE0 = 0x55AA55AA;            //write data within 128bit programming page

                *(unsigned int*)0xFFFDE4 = 0x55AA55AA;            //write data within 128bit programming page

                CFLASH_0.MCR.B.EHV = 1;                                                                           //program page (words that were not written above will have default value 0xFFFF)

                while(CFLASH_0.MCR.B.DONE == 0){};

                CFLASH_0.MCR.B.EHV = 0;

                //end of program sequence

                CFLASH_0.MCR.B.PGM = 0;

#endif  

               

                //program NVUSRO

                CFLASH_0.MCR.B.PGM = 1;                         

                *(unsigned int*)0xFFFE18 = 0xCFFFFFFF;               //configure PAD_3V5V bits to '0' (for 5V supply voltage)

                *(unsigned int*)0xFFFE1C = 0xFFFFFFFF;

                CFLASH_0.MCR.B.EHV = 1;                                                                           //program page (words that were not written above will have default value 0xFFFF)

                while(CFLASH_0.MCR.B.DONE == 0){};

                CFLASH_0.MCR.B.EHV = 0;          

                //end of program sequence

                CFLASH_0.MCR.B.PGM = 0;         

}

 

Be careful when modifying the shadow flash. It’s possible to lock the chip with no way to recover:

https://www.nxp.com/docs/en/application-note/AN3787.pdf

 

If you want to change the shadow flash by GREENHILLS   tools, please contact GREENHILLS  for more help.

 

Regards,

Lukas

0 Kudos