AnsweredAssumed Answered

MPC5674F - Problem accessing shadow flash

Question asked by Jeff Campbell on Jul 14, 2016
Latest reply on Jul 18, 2016 by Jeff Campbell


Hello,

 

My eventual goal is to be able to modify the serial passcode and censorship control words at will, but I'm having trouble getting there.  I've tried following the AN3787 document's example code.  This exact same type of approach worked on various normal flash blocks, but is crashing when I try to access the shadow blocks (I've tried both A and B).

 

/* enable shadow space */

FLASH.LML.R = LOW_ADDR_KEY;

FLASH.LML.R = LOW_ADDR_SR_UNLOCK;

FLASH.SLL.R = S_LOW_ADDR_KEY;

FLASH.SLL.R = LOW_ADDR_SR_UNLOCK;

 

/* step1. erase shadow row */

FLASH.MCR.B.ERS = 1;

W32(SHADOW_ADDRESS, 0x0); //interlock write

FLASH.MCR.B.EHV = 1;

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

FLASH.MCR.B.EHV = 0; //clear EHV

FLASH.MCR.B.ERS = 0; //clear ERS

 

Specifically, when I'm debugging, the program exits at the interlock write for erasing the shadow row, and ends up at a random RAM address executing no code.  What could be causing this?

Outcomes