Time consuming erase operation while using dflash : Alternative methodology

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

Time consuming erase operation while using dflash : Alternative methodology

Jump to solution
705 Views
rubykrishna
Contributor III

Hi All,

 

We are using  MC9S12XHY controller. We used d-flash for data storage. But the problem with d-flash is that i have to erase it before rerogramming.Minimum erase size is 1 sector (256 bytes). Time taken to erase 1 sector is 5ms. So  even to programme one word i need an execution time of  500 ms + 250us. Its nearly impossible to write some critical datas in run time owing to this execution time. So we investigated to minimize it.

 

So whenever we intend programme a word or more, we  provide the erase command for that particular sector, set the flash controller for erase operation,  After providing the command , i will exit  and start executing other  tasks. After some predefined i shall come back and check for the erase completion in the flash register, if its erased i will reprogramme.

 

 

Is it possible to run the code from CPU, while erase  or writing is in progress in flash controller module?

 

Is working in the micrcontroller, but is this correct  approach! help me on this regard!

Labels (1)
1 Solution
568 Views
RadekS
NXP Employee
NXP Employee

Hi ruby,

Yes, you could simultaneously program or erase D-Flash while you running code from P-Flash. Unfortunately you cannot simultaneously read. Therefore at least command Erase Verify D-Flash Section has to be executed from RAM.

As Edward correctly mentioned, you could use interrupt for notification about command complete.

If your data in D-Flash are not too big, you could implement some software based on data versions or EEPROM emulation. In that case, any critical request to write new data will be serviced immediately (into spare sector) and sector erasing will be executed on background.

For more details, please look at application notes:

AN4483 Emulated EEPROM Routines for the S12P Family

http://www.freescale.com/files/microcontrollers/doc/app_note/AN4483.pdf

http://www.freescale.com/files/microcontrollers/doc/app_note/AN4483SW.zip

AN3961 EEPROM Emulation for the MC9S12XS and MC9S12P Families Using AN2302 as a Reference

http://www.freescale.com/files/microcontrollers/doc/app_note/AN3961.pdf

http://www.freescale.com/files/microcontrollers/doc/app_note/AN3961SW.zip

AN2302 EEPROM Emulation for the MC9S12C32

http://www.freescale.com/files/microcontrollers/doc/app_note/AN2302.pdf

https://www.freescale.com/webapp/Download?colCode=AN2302SW


I hope it helps you.

Have a great day,
RadekS

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

View solution in original post

3 Replies
568 Views
rubykrishna
Contributor III

Thanks Radek & Kef..... Its working....

569 Views
RadekS
NXP Employee
NXP Employee

Hi ruby,

Yes, you could simultaneously program or erase D-Flash while you running code from P-Flash. Unfortunately you cannot simultaneously read. Therefore at least command Erase Verify D-Flash Section has to be executed from RAM.

As Edward correctly mentioned, you could use interrupt for notification about command complete.

If your data in D-Flash are not too big, you could implement some software based on data versions or EEPROM emulation. In that case, any critical request to write new data will be serviced immediately (into spare sector) and sector erasing will be executed on background.

For more details, please look at application notes:

AN4483 Emulated EEPROM Routines for the S12P Family

http://www.freescale.com/files/microcontrollers/doc/app_note/AN4483.pdf

http://www.freescale.com/files/microcontrollers/doc/app_note/AN4483SW.zip

AN3961 EEPROM Emulation for the MC9S12XS and MC9S12P Families Using AN2302 as a Reference

http://www.freescale.com/files/microcontrollers/doc/app_note/AN3961.pdf

http://www.freescale.com/files/microcontrollers/doc/app_note/AN3961SW.zip

AN2302 EEPROM Emulation for the MC9S12C32

http://www.freescale.com/files/microcontrollers/doc/app_note/AN2302.pdf

https://www.freescale.com/webapp/Download?colCode=AN2302SW


I hope it helps you.

Have a great day,
RadekS

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

568 Views
kef2
Senior Contributor IV

1) Yes, you can run code from flash, while programming/erasing data EEPROM.

2) EEPROM module is interrupt driven. So you need to organize your address-data, or perhaps command-address-data queue and feed it to EEPROM interrupt handler, which should take care of all erase and program operations.