A little user flash question - MC9S08QE4

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

A little user flash question - MC9S08QE4

1,408 Views
JulsPower
Contributor II
Hi
Im using a 9S08QE4
I want to write some byte in the flash
but I dont know where I have the "right"(by there I mean not to overwrite myself) to write in it

At first I tough at F000 but seem its the start of my program there.
So its right before the non volatile register at FFB0 - 512 byte start the last page I can use?
and if its true is there a way to be sure my program wont be store there and I wont erease it?


thanks to help the noob :smileyvery-happy:

Added p/n to subject.


Message Edited by NLFSJ on 2008-12-29 08:25 AM
Labels (1)
0 Kudos
3 Replies

333 Views
JulsPower
Contributor II
I actualy made it work
I set my PRM file as this
Z_RAM                    =  READ_WRITE   0x0060 TO 0x00FC;
    RAM                      =  READ_WRITE   0x00FD TO 0x015F;
    FLASH_TO_RAM             =  READ_ONLY    0xF000 TO 0xF06F RELOCATE_TO 0x60;
    ROM                      =  READ_ONLY    0xF070 TO 0xFFBF;
    ROM1                     =  READ_ONLY    0xFFC0 TO 0xFFCD;
FLASH_ROUTINES                      INTO  FLASH_TO_RAM;

And I use the page FC00 to write my char, each time I have to write it I put it in the next address,
If its full I erase the page and start from FC00 again


Im not using NVProt at the moment
Should I? What it would give more?
Should I use the Adress F000 page for my variable?, and the program start at adress F200?

0 Kudos

333 Views
Ake
Contributor II
Hello again,
Here is the code required to emulate an EEPROM on the 9S08QE4.
Two things that need to be fixed:
1) I tried to copy a string in the Flash EPROM to the EEPROM, but I only got the first byte of the entire string.
2) I have not implemented the setting of the Flash EPROM protection bits in the NVPROT register.
 
To recover the files, rename the .txt file to .zip and run WinZip  on it.
This will rebuild all the necessary files.
 
Happy New Year,
Ake
 
Message Edited by t.dowe on 2009-10-27 11:56 AM
0 Kudos

333 Views
Ake
Contributor II
Hi,
The protection mechanism, will protect everything above a certain limit. This means that the EEPROM should be placed below a certain limit.
As the page size is 512 bytes, this means that for the 9S08QE4, the EEPROM should start at 0xF000 and end at 0xF1FF. The program memory should start at 0xF200 then.
 
But as the page síze is 512 bytes, and there is no more than 256 RAM bytes available, and that memory should be used for the stack and other variables, the maximum size of the parameters should be set at about 64 bytes. Those 64 bytes are the first in the EEPROM buffer.
 
As the code must be executed in RAM while erasing/programming the Flash EPROM, there are two ways of doing it.
Either you set aside a static buffer that can hold one entire erase/program routine, or you push it on the stack.
 
Now, I have not written it myself, so I cannot say that it is possible.
On the 9S08QE8 it can be done anyhow.
 
Regards,
Ake  
0 Kudos