ssinfod

Flash Erasing + High Page Register. (HCS08AW60)

Discussion created by ssinfod on Mar 7, 2008
Latest reply on Mar 8, 2008 by ssinfod
Hi,
 
I am currently working on a bootloader which is programming a S19 into the Flash memory. My bootloader is based on the AN2295. In addition, I am using an HCS08AW60.
 
Here is my question :
 
I am using the Flash Erase routing from the "HCS08 Family Reference Manual (p.60)" which is working fine for all the pages except of the Page at the address 0x1800 to 0x2000. After looking at the memory map, I have noticed that the High Page Registers are at this location. (High page = 0x1800 to 0x185F)
 
;*********************************************************************
;* FlashErase1 - erases one page of FLASH (512 bytes)
;*
;* On entry... H:X - points at a location in the page to be erased
;*
;* Calling convention:
;* jsr FlashErase1
;*
;* Uses: DoOnStack which uses SpSub
;* Returns: H:X unchanged and A = FSTAT shifted left by 2 bits
;* Z=1 if OK, Z=0 if protect violation or access error
;* uses 32 bytes of stack space + 2 bytes for BSR/JSR used to call it
;*********************************************************************
FlashErase1: psha ;adjust sp for DoOnStack entry
lda #(mFPVIOL+mFACCERR) ;mask
sta FSTAT ;abort any command and clear errors
lda #mPageErase ;mask pattern for page erase command
bsr DoOnStack ;finish command from stack-based sub
ais #1 ;deallocate data location from stack
rts ;Z = 0 means there was an error
;********************
 
Is there any reason that I can't erase the Flash data ranging from 0x1860 to 0x2000 ?
 
For example, I inserted some data at the addresses 0x1900, 0x1B00, 0x1D00 with the command :
         org     $1900
FL1_Data  FCB     "1234567",NUL                                                  ; Dummy data.
         org     $1B00
FL2_Data  FCB     "1234567",NUL                                                  ; Dummy data
         org     $1D00
FL3_Data  FCB     "1234567",NUL                                                  ; Dummy data
 
After I run the erase routine for all the pages, the data are still present only at the 0x1900 location ?
Is that normal ? How should I proceed to erase the data ?
 
Thanks
 
 
 
 
 
 
 

Outcomes