need help about writing in flash (56F8036 / 16 bit controller)

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

need help about writing in flash (56F8036 / 16 bit controller)

1,894件の閲覧回数
andreas_luft
Contributor I
Hello at all,

I am using 56F8036 16 bit microcontroller and I dont know why but I can't write to the flash memory. I have tried the following:

//--- the significant portion of the code: ----------------------------------------------------------------
[...]
#include "periph.h"        // includes: #define periphBitClear( Mask, Addr )  (*(Addr) &= ~(Mask))
#include "IO_Map.h"     // includes: #define FM_PROT   *((volatile word *)0x0000F410)
void pmem_writing();   // prototyp
[...]
void update(void)
{
    UInt16 addr_m;
    UInt16 value_m;
    UInt16 *p_value_m;

    periphBitClear(0xFFFF, &FM_PROT);
           
    addr_m = 0x2000;
    value_m = 0x1234;
    p_value_m = &value_m;

    pmem_writing(addr_m, *p_value_m);
}
[...]
inline void pmem_writing(register UInt16* addr, register UInt16 data)
{
   asm(move.w  data,p:smileysad:addr)+);
}

// --------------------------------------------------------------------------------

But it does not work, what am I making wrong?
ラベル(1)
0 件の賞賛
返信
2 返答(返信)

961件の閲覧回数
DiegoNunes
Contributor I
I'm not sure, but Flash memory of 56F8036 is similar to HC12.
So, read AN2720 and this post:
http://forums.freescale.com/freescale/board/message?board.id=16BITCOMM&thread.id=4011

Diego.
0 件の賞賛
返信

961件の閲覧回数
andreas_luft
Contributor I
Thank You,

i have already a solution, I am using IntFlash - bean.

IntFlash1_SetGlobalProtection(FALSE);
IntFlash1_SetWordFlash(0x0fe0 , 0x1234);    // 0x0fe0: Address, 0x1234: Data
0 件の賞賛
返信