Flash write on GT60

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

Flash write on GT60

2,094件の閲覧回数
FSCu
Contributor I
Hello everybody, I know this has been discussed in previous posts but I still can't achieve to write on flash or even erase the page.
 
I'm using a simple code from AN3404 which apparently follows the flow chart on GT60 manual, the thing is that the code works just fine if I run it step by step, but if I let it to fully run (not step by step or breakpoints) the debugger keep saying me that the frequency has changed and sometimes the program stops or just hang. The Cpu ints are disabled when any flash related operation is made. If it is of any help the app is for write data received from SCI to flash.
 
Here is the code use for page erase and the flash init routine:
 
void InitFlash(void){ 
  FSTAT_FACCERR=1;
  FSTAT_FPVIOL=1; 
  FCDIV = 25; 
}
void NVM_Erase_Page (unsigned char *dest)
{
 
  unsigned char dummy=0;
 
  if (FSTAT_FACCERR == 1 || FSTAT_FPVIOL == 1)        //Verifying error flags
  {
    FSTAT_FACCERR = 0;                                //Clear error flags
    FSTAT_FPVIOL = 0;
  }
  *dest = dummy;
  FCMD = mPageErase;                                  //Byte program command
  FSTAT_FCBEF = 1;                                    //Run the command
 
  _asm NOP;
  _asm NOP;
  _asm NOP;
  _asm NOP;
 
 
 
  if (FSTAT_FACCERR == 1 || FSTAT_FPVIOL == 1)        //Verifying error flags
  {
    FSTAT_FACCERR = 0;                                //Clear error flags
    FSTAT_FPVIOL = 0;
  }
 
  while (FSTAT_FCCF == 0);
 
}
 
The BUS frequency is set around 4.45 MHz
 
Thanks in advance
Victor
ラベル(1)
0 件の賞賛
返信
3 返答(返信)

838件の閲覧回数
FSCu
Contributor I
Thanks you both, you were right, I'm running the routines from the RAM and is working fine.

Victor
0 件の賞賛
返信

838件の閲覧回数
Ake
Contributor III
Hi,
I have not studied the 9S08GT60 compared with the 9S08LC60, but what is different is the Flash EPROM memory layout. The 9S08GT60 has one Flash EPROM and the 9S08LC60 has two.
Because the Flash EPROM needs a stable address and data when a write operation takes place, it is quite easy to do it on the LC60. On the GT60 you need to copy the erasure/programming routine to the stack, and execute it there.
 
But maybe that is the thing that you have done?
 
Regards,
Ake
0 件の賞賛
返信

838件の閲覧回数
peg
Senior Contributor IV
Hi,
What Ake has suggested seems the most likelly cause for the OP's problem.
However, what he "needs" to do is execute the flash programming code from RAM.
Utilising the stack to achieve this is but one method.
</pedantic>
 
AN2140 is a good source for flash programming code for the GB/GT.
 


Message Edited by peg on 2007-10-01 09:58 PM
0 件の賞賛
返信