MKE14F512 FLASH_erase return 103

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MKE14F512 FLASH_erase return 103

Jump to solution
1,332 Views
Molbuy
Contributor I

After FLASH_Init which return status 0 and some FLASH_GetProperty which also returns correct values I try execute below which return status 103 :

regPrimask = DisableGlobalIRQ();

statusF = FLASH_Erase(&configF, 0x42000, 4096, key);

EnableGlobalIRQ(regPrimask);

a FLASH registers is as follow : registers.png

after callFtfxRunCommand((FTFx_REG8_ACCESS_TYPE)(&FTFx->FSTAT)); the FTFE-FSTAT became 0xa0 (10100000) which correspond to status 103

Command execution looks like from right place (RAM) :

ame : config->runCmdFuncAddr.commadAddr

Details:536872649

Default:536872649

Decimal:536872649

Hex:0x200006c9

Binary:100000000000000000011011001001

Octal:04000003311

 

Change  in erase address to  40000 or 41000 gives same result

What is wrong?

 

 

0 Kudos
1 Solution
1,165 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

I don't think the clocking is the issue. I suggest you swap the MCU and execute the same example to see if the problem still persists.
It is important to mention that the MCU must be in RUN mode before executing the command, if a command attempts to be executed in HSRUN mode the device will be trapped.

Let me know if this is helpful, if you have more questions do not hesitate to ask me.
Best regards,
Omar
 

View solution in original post

0 Kudos
11 Replies
1,323 Views
Molbuy
Contributor I

I found this post :

https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-with-Erase-Flash-memory/m-p/823401#M49...

all looks exactly as on Mike screenshots except ram address value (because I have different device)  and that all it doesn't  work

0 Kudos
1,275 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello Molbuy

 

This error indicates that the instruction code is invalid or the address is out of bound.
Which value are you writing in the variable "key"?
Do you have this same problem with the parameters of the SDK example?


I will be waiting for your reply, if you have more questions do not hesitate to ask me.
Best regards,
Omar

0 Kudos
1,269 Views
Molbuy
Contributor I

Hello Omar.

The key is :

uint32_t key = FOUR_CHAR_CODE('k', 'f', 'e', 'k');

and it taken from fsl_ftfx_controller.h, moreover, if execution of code reached the "callFtfxRunCommand" then key  passed before successfully.

Also, as you can see the address of "callFtfxRunCommand" is 0x200006c9 which in range of upper sram region for that device.

Where can I see appropriate sdk example?

0 Kudos
1,261 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello

Thank you for your reply, the key is correct and the command is in SRAM.
I suggest you test your device with the SDK example to check if this problem still persists. You can import the example in the MCUXpresso in the option "Import SDK examples(s)"

nxf54944_1-1614105868326.png

 

nxf54944_0-1614107277453.png

 

Please let me know the results, if you have more questions do not hesitate to ask me.
Best regards,
Omar

0 Kudos
1,235 Views
Molbuy
Contributor I

below is my result :

PFlash Example Start 

 

 PFlash Information: 

 Total Program Flash Size: 512 KB, Hex: (0x80000)

 Program Flash Sector Size: 4 KB, Hex: (0x1000) 

 Flash is UNSECURE!

 

 Erase a sector of flash

 

 

---- HALTED DUE TO FLASH ERROR! ----

 

I just copy a "main" function of flash.c to my project with minor corrections,  then run it from main loop

0 Kudos
1,206 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Thank you for letting me know your findings. I did the same test with different memory locations and the sector erase was successfully executed.
I suggest you check the value in the register FPROTn to verify if this feature is not enabled.
To disable this feature you can refer to chapter 17.4.4.6 of the reference manual: https://www.nxp.com/docs/en/reference-manual/KE1xFP100M168SF0RM.pdf

Let me know if this helps, if you have more questions do not hesitate to ask me.
Best regards,
Omar
 

0 Kudos
1,195 Views
Molbuy
Contributor I

can it relate to clocking?

I currently clock flash from PLL

core clock 120mgz, bus 60mgz, flash 17.14mgz (divcore/7)

0 Kudos
1,166 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

I don't think the clocking is the issue. I suggest you swap the MCU and execute the same example to see if the problem still persists.
It is important to mention that the MCU must be in RUN mode before executing the command, if a command attempts to be executed in HSRUN mode the device will be trapped.

Let me know if this is helpful, if you have more questions do not hesitate to ask me.
Best regards,
Omar
 

0 Kudos
1,148 Views
Molbuy
Contributor I

Yes, switching to RUN mode solve problem

A code from 18f_pflashof sdk examples passed without errors

thanks

0 Kudos
1,155 Views
Molbuy
Contributor I

Yes, a device currently run in HSRUN mode

I will try bit latter to switch to RUN mode and back to HSRUN on the fly and let you know

currently I boosted core clock to 144mgz

0 Kudos
1,197 Views
Molbuy
Contributor I

 FTFE registers look ok, all FPROT = 0xFF

0 Kudos