Ross Myers

MPC5566 writing to Flash

Discussion created by Ross Myers on Jun 11, 2010
Latest reply on Dec 30, 2010 by A K

Hi All,


I having some trouble writing to the internal Flash memory, I can erase the flash blocks fine.

I think my problem is I am not really understanding the steps in the MPC manual for programming.

Ignoring the process of unlocking the blocks (which I'm sure I have right), the MPC manual states:

"Write the first address to be programmed in the flash module with the program data."


A sampe of my code I am using for testing is to write the data $12345678 to address 0x0006_0000


 lis          r12,6           ; Hardcode to address $60000 for testing
 lis          r11,1234
 ori          r11,r11,5678    ; Try to write 12345678 to $60000
 stw          r11,0(r12)


Then turn on the EHV bit.


But this doesn't work, in fact it makes the CPU reset.

Am I missing something?