How to check memory flash sector in MCXA cpu

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

How to check memory flash sector in MCXA cpu

Jump to solution
437 Views
_Ferrari_
Contributor V

Dear all,

I'm developing a project based on the MCXA153VLH and I have to read and write a sector of internal flash memory.

I have developed a procedure based on romapi_flashiap example in the SDK but in the SDK example I can't find any procedure to verify if a sector of flash memory is erased or written.

The problem I have is that, on power-on, I need to check if a flash memory sector has never been written. If that's the case, I have to initialize it with default data.

 

Did you encountred asimilar problem ?

How did you fix it ?

Thank you very much for your help and cooperation

regards

Labels (1)
Tags (2)
0 Kudos
Reply
1 Solution
287 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi _Ferrari_,

MCX and LPC55 Flash are different.  LPC55Sxx parts are delivered from the factory mass erased with ECC unset. If performing AHB reads of the flash memory contents AFTER a sector erase, we will have the same HardFault issue. We need to program the sector or use Flash controller read command to overcome it. See my article on this topic

[LPC55xx] How to fix AHB Read HardFault Error - NXP Community

MCX Flash don't have this limit.  While Flash verify API function still works for MCX.

Hope this will help you.

Jun Zhang

View solution in original post

0 Kudos
Reply
3 Replies
404 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi @_Ferrari_ 

The MCX153 Flash memory has default values of all 0xFF when erased. Therefore, we can check if the specific Flash memory bits are all ’1‘ to determine whether the Flash sector has been written to. If all the contents in a sector are read as 0xFF, the sector is unused.

Does this answer your question?

Hope this helps,

Jun Zhang

0 Kudos
Reply
368 Views
_Ferrari_
Contributor V

I previously used an LPC5526 processor, where the flash memory could have three states:

erased

programmed (or written)

uninitialized

So, before accessing the flash, I had to use the FLASH_VerifyErase function to check if the flash was accessible. It seems to me that, with this type of processor, the problem doesn't exist. Can you confirm?

Thank you very much for your help and cooperation

regards

Tags (2)
0 Kudos
Reply
288 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi _Ferrari_,

MCX and LPC55 Flash are different.  LPC55Sxx parts are delivered from the factory mass erased with ECC unset. If performing AHB reads of the flash memory contents AFTER a sector erase, we will have the same HardFault issue. We need to program the sector or use Flash controller read command to overcome it. See my article on this topic

[LPC55xx] How to fix AHB Read HardFault Error - NXP Community

MCX Flash don't have this limit.  While Flash verify API function still works for MCX.

Hope this will help you.

Jun Zhang

0 Kudos
Reply