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!