MPC5674f shadow erasing issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MPC5674f shadow erasing issue

跳至解决方案
1,284 次查看
oloooloo
Contributor III

ERASING CODE:

                FLASH_A.LMLR.R = FLASH_LMLR_PASSWORD;    //unlock register
                FLASH_A.LMLR.R = 0x000303FF;    //unlock shadow flash
                FLASH_A.SLMLR.R = FLASH_SLMLR_PASSWORD;    //unlock register
                FLASH_A.SLMLR.R = 0x000303FF;    //unlock shadow flash

                //erase shadow flash
                FLASH_A.MCR.B.ERS = 1;
                *(unsigned int*)0x00FFC000 = 0xFFFFFFFF;    //interlock write - write any address in shadow block
                FLASH_A.MCR.B.EHV = 1;
                while(FLASH_A.MCR.B.DONE == 0){};
                FLASH_A.MCR.B.EHV = 0;
                FLASH_A.MCR.B.ERS = 0;

               (below is code to set censor password etc, this part is not executed because above hangs)

ISSUE:

this code hangs, code below above block is not executed, after reset i see that shadow is erased, but for some reason erasing procedure hangs, any ideas why?

TEST1:

removed line: while(FLASH_A.MCR.B.DONE == 0){};

result: shadow erased and code hangs

TEST2:

removed line: *(unsigned int*)0x00FFC000 = 0xFFFFFFFF;

result: shadow is NOT erased but NO code hanging, normal execution is proceed

REMARK:

also L0, L1,L2 and L3 has the same behavior, erasing procedure hangs...

the rest of sectors i men L4 to L9, M0,M2, H0 to H5 goes normally.

L0, L1,L2,L3 belongs to partiton 1, this is something common.

I am booting from L0 and then jump to RAM from where executing erasing.

any ides what is wrong? suppose its not problem of code itself, is trivial...hw configuration?

0 项奖励
回复
1 解答
959 次查看
oloooloo
Contributor III

looks like problem solved, bootloader is stettng valuses in some registers, if i set them back to 0 erasing does not hang, those registers are:

  *(unsigned int*)0xC3F91684 = 0x0;
  *(unsigned int*)0xFFF48008 = 0x0;
  *(unsigned int*)0xFFF4816D = 0;
  *(unsigned int*)0xC3FF0000 = 0;
  *(unsigned int*)0xC3FF0100 = 0;
  *(unsigned int*)0xC3FF0108 = 0;
  *(unsigned int*)0xC3FF010C = 0;

在原帖中查看解决方案

0 项奖励
回复
2 回复数
960 次查看
oloooloo
Contributor III

looks like problem solved, bootloader is stettng valuses in some registers, if i set them back to 0 erasing does not hang, those registers are:

  *(unsigned int*)0xC3F91684 = 0x0;
  *(unsigned int*)0xFFF48008 = 0x0;
  *(unsigned int*)0xFFF4816D = 0;
  *(unsigned int*)0xC3FF0000 = 0;
  *(unsigned int*)0xC3FF0100 = 0;
  *(unsigned int*)0xC3FF0108 = 0;
  *(unsigned int*)0xC3FF010C = 0;

0 项奖励
回复
959 次查看
oloooloo
Contributor III

What i checked already, if boot goeas from bootloader located on FlashA L0 then erasing of L0 to L3 and Shadow hangs (of course ersasing executed from RAM). If the same functionality are executed via BAM, all works fine!

Is it hw bug?

0 项奖励
回复