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!
-----------------------------------------------------------------------------------------------------------------------