Problems in programming Flash

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

Problems in programming Flash

2,723件の閲覧回数
marchè
Contributor I
Hi... Can you help me?
I have still some problems in programming Flash memory.
I'm using Metrowerks Codewarriors and the HCS12 CPU (the devise is the MC9S12A256BCFU with 256K of banked flash memory).
I have to program the flash memory (for the Bootloader) and I'm writing in C.
The function that I use is:

void ProgramWord( int page, int block, unsigned int prg_address, unsigned int value)

{ unsigned int* address=(unsigned int*)prg_address;

 

 

 

   FCNFG_BKSEL=block;

 

   PPAGE=page;

 

   while ( FSTAT_CBEIF==0 );

   *address=value;

 

   FCMD=0x20;

 

   FSTAT_CBEIF=1; 

    __asm   nop;

    __asm   nop;

    __asm   nop;

    __asm   nop;

    __asm   nop;

     if ( FSTAT_ACCERR==1 || FSTAT_PVIOL==1 )       flash_errors++;

}  

Thank you for your help......  

Message Edited by march� on 2006-06-14 04:10 AM

ラベル(1)
0 件の賞賛
返信
2 返答(返信)

556件の閲覧回数
marchè
Contributor I
Thanks... I have found the bug.....
0 件の賞賛
返信

556件の閲覧回数
Sten
Contributor IV

Take a look at this thread http://forums.freescale.com/freescale/board/message?board.id=16BITCOMM&message.id=829&jump=true

I had to replace the CBEIF-check with a check of the CCIF-bit instead.

 

0 件の賞賛
返信