K22 flash section erasing problem

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

K22 flash section erasing problem

1,193 Views
soerenbirth
Contributor I

Hey,

have problems to erase a flash section. I'm using MK22FN512VLH12.

i'm using the C90TFS Driver. The erase command is set correct in the FCCOB-registers and the flash machine responses no errors. But the flash section isn't erased. It's untouched.

-> MemoryAndFTFA-Registers.PNG

The flash command sequence is copied to ram and is performed.It's the same disassembly like the "FlashCommandSequence" - function

-> FunctionInRam.PNG

-> RamDissassembly.PNG

If i put a wrong section address in the FCCOB-register it responses with an ACCERR.

The code seems to work if i erase/write section in the other block ( address > 0x3FFFF).

I can't share the code.

Labels (1)
0 Kudos
7 Replies

924 Views
soerenbirth
Contributor I

Hello Kerry,

This is exactly what i mean. As you can see in my screenshots the memory browser keeps it values, even when i refresh it or when i reenter the address (0x2800 in this case).

regards Sören

0 Kudos

924 Views
davidsherman
Senior Contributor I

I had a similar issue on a KE18.  It was not the debugger at all, but it was because the region of flash I was erasing was cached.  I had to clear the cache after erasing to force it to refresh.  You might have to refer to the cache controls for the K22 to see how to do that.

0 Kudos

924 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Soeren Birth,

   It should be caused by the KDS bug.

   In my memory, this problem should already be report.

  So, normally, if you find the data is not the data what you want in the IDE memory, you also can use the variable to read the according flash address, then you just need to read the variable, or printf it out, this is also the way what I like to check.

Wish it helps you!

Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

924 Views
soerenbirth
Contributor I

Hey Kerry,

I got it. The code works!!!! It's just the ?%&.§$ debugger that do not. I read the code with the J-Flash tool and there is a clean section.

Please fix the debugger problems, its really annoying.

Regards Sören

0 Kudos

924 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Soeren Birth,

    What do you mean: It's just the ?%&.§$ debugger that do not. 

   Do you mean the KDS memory display is not correct?


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

924 Views
mjbcswitzerland
Specialist V

Hi

Always maintain a healthy mistrust of the debugging tools since believing everything yo see can result n loss of time.

Some debuggers also need the memory view refreshing to be sure that they keep in sync. with Flash content.

This is the interface used in the uTasker project which ensures no such confusions can occur and testing/verification can be done at any time without a debugger:
https://www.youtube.com/watch?v=Pe9A8qsefzQ&t=28s

Regards

Mark

0 Kudos

924 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Soeren Birth,

   Please try our KSDK2.2_FRDM-K22F120M flash code.

   You can download the KSDK2.2 code from this link:

Welcome to MCUXpresso | MCUXpresso Config Tools 

  Click SDK builder, choose board as FRDM-K22F, this board's chip is MK22FN512VLH12, after generate the code, and download it, you can find the flash code in folder:

SDK_2.2_FRDM-K22F\boards\frdmk22f\driver_examples\flash\pflash\iar

 I changed the erase flash sector address below 0x3FFFF, take an example:0x3f800, I can do the flash sector erase, program, erase again succesflly.

  So, please try this code.

  Modify the pflash.c line destAdrss to 0X3F800, like this:

pastedImage_207.png

After program the 0X3F800, the according address will have data:

pastedImage_208.png

Do the flash sector erase again

pastedImage_209.png

You can find the sector in address 0x3f800 is erased again.

When you run the code in the flash, please make sure your erased sector is not in the code sector, otherwise it may damaged your application code, you can check the code size whether it is in your erased flash sector.

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos