TPMS_FLASH_ERASE() 和 TPMS_FLASH_WRITE() 执行后,flash的内容没有变化,代码如下:
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]); // 收到 { 44 55 66 }
mRfData1 = TPMS_FLASH_ERASE((WORD)CParaAddr); // 返回值为0,成功了?
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]); // 还是收到 { 44 55 66 }
|