MC9S08DN60 data sheet rev.2 is at least ambiguos when refering on EEPROM. I would expect EEPROM was a storage area which could be programmed from everywhere in the main program in flash without any special care other than some precise timing and possibly continuing making other tasks during programming, i.e. simple interrupt servicing, like I did on the venerable 68HC705CB16.
From what I discovered by a careful reading of chapter 4 of the data sheet, there is no evidence of difference from the main FLASH memory: EEPROM and FLASH are essentially the same and they require the same programming and timing. The sector sizes are different 8 vs. 768 bytes, hence there is more granularity on erasing but the time to erase a small 8 bytes sector and a larger 768 one is the same: i.e. 20ms minimum, nominal. A small advantage is that only 20 to 45us plus some overhead is needed to program an EEPROM cell compared to 10ms of the old 705B uC.
Nowhere in that chapter I read that FLASH must be programmed only from RAM like it is on the others 9S08 families without EEPROM. Can I resolve that FLASH and EEPROM as present on 9S08DN are separate pages of FLASH, with different sector size and they may be programmed each from the other without relying only on RAM?
In that case I can put some basic FLASH program routines on EEPROM avoiding to copy everytime them on RAM and I can perform EEPROM operation smoothly from the main program on FLASH with program routines also on FLASH.
In my case perhaps the write process is not so disturbing but I cannot wait for at least 20ms to erase an 8 byte sector: I need to do some other tasks in the meanwhile. If this is not possible I will be forced to use external EEPROM but this does not seem to be reasonable to me: why in fact declare EEPROM on the uC if this is not simply accessible from main program?
In conclusion may someone of you guys answer to:
- EEPROM may regularly be written and erased just from routines on FLASH and these routines (specially the long erase ones) may be interrupted
- Precise timing of write and erase routine is not required: either FLASH and EEPROM are managed by an hardware state machine which relies only on the precision of the flash clock: as soon as the required process time has expired, the program charge pump is automatically turned off.
- FLASH may be programmed even from EEPROM area in addition to RAM
- Is there some unambiguos official Freescale document I missed which explains these subject specifically on the 9S08DN series? I was able to find AN2156 and AN3404 but these are not pertinent to the 9S08DN nor there is anything on EEPROM on the cited HCS08RMv1 HCS08 Family Reference Manual vol. 1