simulate Flash write with CW - HC08908GP32

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

simulate Flash write with CW - HC08908GP32

2,224件の閲覧回数
zen
Contributor I
Hi, all
    I am using cw to learn some assembly instrcutions. I chose HC08908GP32 device  When I write to an address in flash. CW reported an Error that "Attempt to write to ROM."  Does flash equals ROM? my code is as follows:
            ; test IX addressing mode
            lda #10
            ldhx #$A010
            sta ,x
 
the report of Error occured at the last line, " sta ,x"
 
Thanks
zen
 
 
 
 
Added p/n to subject.


Message Edited by NLFSJ on 2008-05-07 07:35 AM
ラベル(1)
0 件の賞賛
返信
4 返答(返信)

690件の閲覧回数
peg
Senior Contributor IV
Hi zen,

FLASH memory is a type of ROM in that you cannot simply write to it (say with STA) and the value is retained there. This is only useful with RAM where it will remain as long as it is powered.
It is not ROM in that you can write to it but only using special techniques and only after a section (page) is erased first. Refer to the FLASH Memory chapter in the GP32 datasheet.

0 件の賞賛
返信

690件の閲覧回数
zen
Contributor I
thanks, peg
     After reading your reply,  I reviewed a textbook on digital circuit and searched on google. Due to the physical principle of Flash Memory, wrtting a memory cell is accomplished by first applying a required high voltage (programming voltage) to the cell, then write the data. GP32 contains a charge pump which is capable of produce the required high voltage from its normal voltage, the charge pump is controlled through programming. Under normal voltage, the memory cell is read-only.
     As far as programming is concerned, Flash memory puts a contraint on program structure design. For example, you cannot store a constant in Flash use " sta <flash address>..", instead, you can use
                              ORG    <flash address>
ConInFlash:           DC.B   <constant> 
 
when programming the device, the <constant> is written to the flash address <flash address>.
 
Best Regards
zen
0 件の賞賛
返信

690件の閲覧回数
peg
Senior Contributor IV
Hi zen,

What you have described is how to place constants in flash along with the programme code when you originally programme the device.
What I thought you were trying to do was write to flash during execution of your programme, therefore I referred you to the FLASH programming chapter in the datasheet.
This way you can treat some of the flash memory as EEPROM and use it for storing data that needs to be retained through power down periods but which is not known at original programming time (i.e. some kind of calibration data that has to be carried out periodically to allow for drift etc).

0 件の賞賛
返信

690件の閲覧回数
zen
Contributor I
hi, peg:
 
  Thanks for reminding. I really did not realize that the data produced during the execuation of my program can be stored in flash. I read the Flash Memory chapter and my understraning is that, to store data in flash during the execuation of program, the FLASH Block Protect Register must be set first during the programming of the device. Then, writting data to flash during the execuation of program is achievable if the necessary procedures for programming flash are followed.
 
Regards
zen
0 件の賞賛
返信