MPC5567: word based Flash programming routine

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

MPC5567: word based Flash programming routine

1,599 Views
emmemondo
Contributor I

Hi,

 

 

I am developing a routine to write a single word in internal flash.

 

I've tryed the following code but it doesn't work:

 

 

 //The sector is already unlocked

 

 t_WORD *pa;

 

pa = (t_WORD *)0xA0000; //High Memory, sector 1 

 

  FLASH.MCR.B.PEAS = 0;
  FLASH.MCR.B.PGM = 1;
 *pa = 0xCAFE;   // Data Interlock Write
  FLASH.MCR.B.EHV = 1;
   while(!FLASH.MCR.B.DONE)
      {
       ; 
      }
      FLASH.MCR.B.PEG = 1;
      FLASH.MCR.B.EHV = 0;
      FLASH.MCR.B.PGM = 0;

 

 ...

 

The question is that if when the "data interlock" instruction an EXCEPTION IVOR2 arise and the system hang.

What's wrong with the code above?

 

Thanks to all,

 

emme

 

emme

0 Kudos
Reply
3 Replies

780 Views
jonr
Contributor III

You can go to ecu.zeeff.com to find some working flash writing code.

0 Kudos
Reply

780 Views
r_james14
Contributor I

did you ever find a solution

0 Kudos
Reply

780 Views
jej13
Contributor II

Hi,

 

I have exactly the same problem (to erase and program the internal flash).  

I work on the MPC5554 but the problem is the same.

Did you find the solution?

 

Thank you.

0 Kudos
Reply