AnsweredAssumed Answered

MPC5668G - locked out of shadow flash?

Question asked by Jitesh Shah on Sep 17, 2018

So I was working with programming the shadow flash on MPC5668G. I wasn't performing ANY erase operation at all - just programming.

 

In one instance, I wrote to a 32-bit aligned address (0x00FFC004). The board has refused to boot after that. I later read in the manual that shadow-flash addresses need to be 64-bit aligned.

 

What has happened to the board and what is the best way to recover from it?

 

Jitesh

 

PS:

Code I used to program shadow flash (incorrectly):

 

// Unlock flash
if (!(MEM_READ(FLASH_LML) & FLASH_LML_LME))
    MEM_WRITE(FLASH_LML, FLASH_LML_PASSWORD);
if (!(MEM_READ(FLASH_SLL) & FLASH_SLL_LME))
    MEM_WRITE(FLASH_SLL, FLASH_SLL_PASSWORD);

 

// unlock shadow block for programming
MEM_AND(FLASH_LML, ~FLASH_LML_SLOCK);
MEM_AND(FLASH_SLL, ~FLASH_SLL_SSLOCK);

 

// Write to shadow space
MEM_WRITE(FLASH_MCR, FLASH_MCR_PGM); // Init flash for PGM operation

MEM_WRITE(PVU32 (START_OF_SHADOW_FLASH + SLOTB_OFFSET), LC_PROD_FUSED); // Unfortunately I set SLOTB_OFFSET to 0x4. START_OF_SHADOW_FLASH = 0x00FFC000
MEM_OR(FLASH_MCR, FLASH_MCR_EHV); // Enable high voltage

tick = xTaskGetTickCount();
while (!(MEM_READ(FLASH_MCR) & FLASH_MCR_DONE) && TICK_DELTA_NOW(tick) <= FLASH_OP_TIMEOUT);

Outcomes