Flash Erasing + High Page Register. (HCS08AW60)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Flash Erasing + High Page Register. (HCS08AW60)

1,514 次查看
ssinfod
Contributor IV
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
 
 
 
 
 
 
 
标签 (1)
0 项奖励
回复
2 回复数

466 次查看
bigmac
Specialist III
Hello,
 
What address location is latched prior to commencing the erase command?  If it happened to be the nominal start of the 512 byte block at 0x1800, this would not be a flash address in this instance.  I wonder if this has been overlooked.
 
Regards,
Mac
 
0 项奖励
回复

466 次查看
ssinfod
Contributor IV
Thanks bigmac, that is it...
 
I was using the address 0x1800 to erase the first page. I changed it to 0x1860 and it worked.
 
 
0 项奖励
回复