S32K142 Flash Write Error

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

S32K142 Flash Write Error

跳至解决方案
5,407 次查看
Ada_Lovelace
Contributor IV

Hi,All

I meet a problem about Flash Writing:

When I set the App address:0x0010000, when I erase and write the value  firstly, it worked.

But when I erase and write Flash secondly, it  causes errors. 

FTFC_FSTAT_CCIF and FTFC_FSTAT_MGSTAT0 set  1. Then I debug the memory view, the address shows "?".

The S32k142 address:

Ada_Lovelace_0-1635227335871.png

 

What should I do to solve the problem?

Snipaste_2021-10-26_13-18-52.pngSnipaste_2021-10-26_13-19-35.pngSnipaste_2021-10-26_13-30-19.pngSnipaste_2021-10-26_13-30-51.png

0 项奖励
回复
1 解答
5,368 次查看
Ada_Lovelace
Contributor IV

Hi,Daniel

I debug the project,  Flash Erasing do not work,so when I program the Flash firstly,it may write value into the address.But it causes error when I write the different value into the same address.

So I check the Flash Driver Project and Bootloader,I find the different about clock.

So I check the clock about Flash, clock reference is 26.67Mhz, I  set the wrong value,so I change it.

Now it works.

在原帖中查看解决方案

4 回复数
5,401 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @Ada_Lovelace,

Which FTFC command fails with MGSTAT0 = 1?

Do you launch the command from SRAM / DFlash?

 

BR, Daniel

0 项奖励
回复
5,398 次查看
Ada_Lovelace
Contributor IV

When  I write again, it  causes  MGSTAT0.I think it is something wrong with erase?

I do not launch the command from SRAM / DFlash, I use the code Flash address,could you tell me the right way to do the Flash about S32k142?

0 项奖励
回复
5,385 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Do you use SDK/RTD or your own code?

Can you share the project?

Anyway, the code that launches the FTFC Erase Sector or Program Phrase commands, cannot be in PFlash if the commands erase or program PFlash, because there is only one PFlash partition.

danielmartynek_0-1635247301926.png

danielmartynek_1-1635247342155.png

 

BR, Daniel

 

0 项奖励
回复
5,369 次查看
Ada_Lovelace
Contributor IV

Hi,Daniel

I debug the project,  Flash Erasing do not work,so when I program the Flash firstly,it may write value into the address.But it causes error when I write the different value into the same address.

So I check the Flash Driver Project and Bootloader,I find the different about clock.

So I check the clock about Flash, clock reference is 26.67Mhz, I  set the wrong value,so I change it.

Now it works.