Flash & EEPROM erase block

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

Flash & EEPROM erase block

1,250 Views
michael_90300
Contributor I

Hello,

 

I am using MC9S12ZVCRM micro.

I have a question about the memory erasing.

Currently I reached to erase a P-Flash sector (512Bytes) by using Erase P-Flash Sector command.

But I need to erase all application block (from 0xFD0000 to 0xFF7FFF -> 160 Kb), I can do it by calling  Erase P-Flash Sector command 320 times… but it is very long and not clean...

There is a command Erase Flash Block, but I do not understand how to use it.

How can use "Erase Flash Block" command to erase P-Flash memory from 0xFD0000 to 0xFF7FFF ?

How can use "Erase Flash Block" command to erase the whole EEPROM memory?

Someone can explain or share an example?

Thanks a lot for your help!!!

Best Regards

0 Kudos
Reply
1 Reply

1,223 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

The description of the command can be found in the RM. There is no example code.

 

dianabatrlova_2-1604907887639.png

However, it is important to consider that "Erase Flash Block" belongs to the "Mass Erase" operation.

And during this operation the P-flash cannot be read because this simultaneous operation is not allowed, see the image below. So, the CPU cannot read P-flash and interrupt vectors. The solution could be to move your code into RAM. For example, the AN12086, AN12086SW has the possibility to move the whole bootloader code into the RAM to self-update.

dianabatrlova_0-1604670578595.png

I hope it helps.

Best regards,

Diana

0 Kudos
Reply