K61 Flash Block 0 MGSTAT0 error

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

K61 Flash Block 0 MGSTAT0 error

820 次查看
AnEngineer
Contributor II

Dear all,

I have a Kinetis K61, and used the swap mechanism before successfully.

Because of the need of more than the 512K Flash avaliuable in swap mode, we decided to use a "normal" firmware update. So I get the image via Ethernet, and buffer it to DDRRAM. So fine. I erase Block0 and Block1 using the FlashEraseBlock(&ftfl_cfg_ram, PFLASH_HALF1_BASE, FlashCommandSequence);

Then I program the image to Block 0 using FlashProgramPhrase(&ftfl_cfg_ram, PFLASH_HALF0_BASE, 0x80000, 0x80400000, FlashCommandSequence);

Using this, I already get the MGSTAT0 error bit. If I flash the Image (which is actually smaller than 512K) in Block1, there is no error bit.

The whole mechanism works, if I flash the same image as if the one which already is running on the processor. After the reset everything is fine again. If I flash a modified image, I get the MGSTAT error, and before branching to main after the reset I get a hardfault.

Is there anythin special to do, that writing to Block0 gives no MGSTAT0 error, and so the processor will start after the reset?

0 项奖励
回复
1 回复

631 次查看
AnEngineer
Contributor II

Update:

I solved the problem using another erase method.

Before I used two erase commands: erase Block 0 and erase Block 1. After this I flashed the new content and got the error flag.

Now I use EraseAllBlock, and flash the new content. With this command everything is fine.

Does anyone know a definite reason for this behaviour? I think by the different command, the controler wioll do something like a mass erase, and so perhaps unlock special flags which are neccessary for programming block 0?

It would be great to know the real reason for this.

0 项奖励
回复