FXTH87 flash operation functions

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

FXTH87 flash operation functions

588 Views
fuhuiming
Contributor I

Why nothing changed after calling function TPMS_FLASH_ERASE() and TPMS_FLASH_WRITE() ? What's wrong with code below ?

fosc = 8MHz, fbus = 4MHz

FCDIV = 21;                                         // Fclk = 4MHz / (21+1) = 181.18KHz - 150KHz~200KHz

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

const BYTE CParaAddr[] @ 0xD200u =

{

0x44, 0x55, 0x66, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,

0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,

};

......

FCDIV = 21;

SendDebugContent(CParaAddr[0], CParaAddr[1], CParaAddr[2]);          // receive data are { 44 55 66 }

mRfData1 = TPMS_FLASH_ERASE((WORD)CParaAddr);                      // the function return 0x00, ERASE succeed ?

mCommonBuffer[0] = 0x77;

mCommonBuffer[1] = 0x88;

mCommonBuffer[2] = 0x99;

TPMS_FLASH_WRITE_1A((WORD)CParaAddr, &mCommonBuffer[0], 10);

SendDebugContent(CParaAddr[0], CParaAddr[1], CParaAddr[2]);

0 Kudos
2 Replies

386 Views
fuhuiming
Contributor I

Resolved. CParaAddr is defined as const array.

SendDebugContent(CParaAddr[0], CParaAddr[1], CParaAddr[2]);

The compiler give three const to the function as parameters directly, instead of accessing the const array again.

0 Kudos

386 Views
fuhuiming
Contributor I

the 2nd time calling

SendDebugContent(CParaAddr[0], CParaAddr[1], CParaAddr[2]);

receive data is still { 44 55 66 }, nothing changed

0 Kudos