DFlash writing MPC560D40

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

DFlash writing MPC560D40

1,186 Views
liviuc
Contributor I

Hello,

 

How is it possible to  write 64 bit in the DFLASH with one High Voltage operation?

I try like this:

   PGM = 1

   (0x00800000) = 0x1122334455667788;

   EHV = 1

 

   wait for DONE

   EHV = 0

   PGM = 0

 

The result is:

0x00800000 = 0xFFFFFFFF;

0x00800004 = 0x11223344;

 

What am I doing wrong?

 

I know that on the 5604 the writing was possible and since it is the same architecture it should be pretty straight forward. Also, the datasheet specifies it is possible (check attachment).

 

Thank you for your support.

Labels (1)
0 Kudos
3 Replies

980 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

this piece of code works as expected:

  /* unlock */
  DFLASH.LML.R = 0xA1A11111;    //write password
  DFLASH.LML.R = 0x00000000;    //unlock all 4 16k blocks
  DFLASH.SLL.R = 0xC3C33333;    //write password
  DFLASH.SLL.R = 0x00000000;    //unlock all 4 16k blocks
 
  /* erase */  
  DFLASH.MCR.B.ERS = 1;    //erase operation
  DFLASH.LMS.R = 0xF;        //select all 4 block for erase
  *(unsigned int *)0x00800000 = 0xFFFFFFFF;    //interlock write  
  DFLASH.MCR.B.EHV = 1;   while(DFLASH.MCR.B.DONE == 0);
  DFLASH.MCR.B.EHV = 0;
  DFLASH.MCR.B.ERS = 0;

  /* program one double word */
  DFLASH.MCR.B.PGM = 1;    //erase operation  
  *(unsigned int *)0x00800000 = 0xAABBCCDD;    //interlock write
  *(unsigned int *)0x00800004 = 0x11223344;    
  DFLASH.MCR.B.EHV = 1;
  while(DFLASH.MCR.B.DONE == 0);
  DFLASH.MCR.B.EHV = 0;
  DFLASH.MCR.B.PGM = 0;  

  /* read */
  data1 = *(unsigned int *)0x00800000;
  data2 = *(unsigned int *)0x00800004;

Regards,

Lukas

0 Kudos

980 Views
liviuc
Contributor I

Hi Lukas,

Thank you for your help and interest into this problem.

This is the first solution that I tried after reading the datasheet.

Tried it again today just for confirming my problem was still there.

The specific behavior is as follows:

 PGM =1

...

*(unsigned int *)0x00800000 = 0xAABBCCDD;  

         - interlock write not done -> only address latching

  *(unsigned int *)0x00800004 = 0x11223344; 

         - this value gets written into latched address (0x00800000)

         - address 0x00800004 is untouched

Watched the behavior using disassembly and the operations are executed as expected so I exclude the compiler making any optimizations.

Thank again for your reply.

0 Kudos

980 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Could you send me the project to be able to reproduce the issue?

Thanks,

Lukas

0 Kudos