Hi,
I am writing an application where I write to Flash, I am using the MC9S08GT60, and have a routine to Erase a page. But how do I calculate the page number ?
I want to erase any memory location from $182c to $f7ff, and also from $1080 to $17ff (I have an application at address $f800 ->), I understand a page is 512 bytes long do I simply divide by 512 to get the page? So $1080 would be in page 8?
Thanks
Neil
Hello Neil,
Yes, the flash page size is 512 bytes for most 9S08 devices, but there are also a few exceptions.
The process of erasing a page does not usually require the calculation of a page number - the process requires to write any value to an address within the page to be erased. If the page erase function you are using requires the entry of a page number, rather than an address, any offset requirements would be determined by the function itself.
Regards,
Mac
PPAGE 0 starts at 0x2180 and ends at 0x3BFF,
0x2180 is not on a 512 byte page boundary.
How is a Page Erase command handled if attempted on address 0x2180?
Will it work,
or is there a conflict with the RAM ending on 0x217F?
Anders J
Hello Anders,
It is not clear to which device you refer - presumably not the 'GB60. Using the 'GB60 example, this has RAM that extends to 0x107F, with flash memory from 0x1080 upwards. The first flash sector has the theoretical range 0x1000 to 0x11FF, but only 384 of the 512 bytes are accessible.
I would not expect conflict with RAM provided the address written to during the erase process is 0x1080, or above. There is also a similar situation where the high page registers overlap a flash sector.
Regards,
Mac
HI Mac,
I am sorry for being unclear.
I am referring to the DZ128, which has RAM up to 0x217F.
Assuming your reasoning applies to the DZ128 as well, believe you have answered my question.
Thank you,
Anders J
Hello Anders,
I think that the sector size for the 'DZ is 768 bytes, rather than 512 bytes. But this probably doesn't affect the basic issue, only the calculation of the start of each flash sector.
Regards,
Mac