AnsweredAssumed Answered

Flash MPC55xx

Question asked by Joe Smith on Mar 21, 2013
Latest reply on May 13, 2013 by Jon Zeeff

    Hi Can Anyone give me some advice on how to program me the flash on mpc55xx, in C.

 

I have the following code

 

main()

{

  unsigned long* FlashRegister   ;

 

  FLASH.HLR.R = 0xB2B22222;

  FLASH.HLR.B.HBLOCK = 0b1;

  FLASH.HSR.B.HBSEL = 0b1;

 

  FlashRegister = ((unsigned long*)(0x80000));

 

  FLASH.MCR.B.PGM = 1;

  *(FlashRegister) = 5;

 

  FLASH.MCR.B.EHV = 1;

 

  while(FLASH.MCR.B.DONE == 0)

  {

 

  }

  FLASH.MCR.B.EHV = 0;

  FLASH.MCR.B.PGM = 0;

}

 

but when i try and read the address back it still says its 0xffffffff.

 

It properly something really stupid.

 

Cheers

 

Joe

Outcomes