你好, 我司ch563q的案子,目前正參考/exam/IAP_DEMO 在做 軟件升級(jí)功能,
數(shù)據(jù)是從主板(usb host)傳送到ch563(usb device), 每次數(shù)據(jù)長(zhǎng)度是500 Bytes,
FLASH_ROM_ERASE是沒(méi)問(wèn)題的,但是第一個(gè)FLASH_ROM_WRITE就一直是返回 0xFC,
不曉得這個(gè)返回值是什么意思 ?? 麻煩幫忙看下,謝謝。
以下是我們代碼和打印信息:
{
???STEBMSG_IAP_PROM *p = (STEBMSG_IAP_PROM *)pstMsg->pBuf;
???unsigned int nSz = pstMsg->stHdr.nSz - MAX_EXBRD_HDR - 4;
???UINT32 nAddr;
???int i;
???char nChkSum = 0;
???for(i=0;i < nSz;i++)
???{
??????nChkSum += p->pData[i];
???}
???if(nChkSum != p->nChkSum)
???{
??????gstRespMsg.stHdr.nMsgId = pstMsg->stHdr.nMsgId;
???}
???else
???{
??????nAddr = (p->pAddr[0] | ((UINT32)p->pAddr[1] << 8) | ((UINT32)p->pAddr[2] << 16));
??????i = FLASH_ROM_WRITE(nAddr, (PVOID)&p->pData[0], nSz);
??????if(i? !=? 0)
??????{
?????????gstRespMsg.stHdr.nMsgId = pstMsg->stHdr.nMsgId;
??????}
???}
???printf("[test]IAPPGM i:0x%X, nSz:%d, Sum:0x%02X, 0x%02X, nAddr:%d, MsgId:0x%02X\n", i, nSz, nChkSum,??? p->nChkSum, nAddr, gstRespMsg.stHdr.nMsgId);
}
打印信息:
[test]IAPPGM i:0xFC, nSz:500, Sum:0x3E, 0x3E, nAddr:0, MsgId:0xD0
RMsgId:0xD0
[test]IAPPGM i:0xFC, nSz:500, Sum:0x3E, 0x3E, nAddr:0, MsgId:0xD0
RMsgId:0xD0
[test]IAPPGM i:0xFC, nSz:500, Sum:0x3E, 0x3E, nAddr:0, MsgId:0xD0
RMsgId:0xD0
[test]IAPPGM i:0xFC, nSz:500, Sum:0x3E, 0x3E, nAddr:0, MsgId:0xD0
RMsgId:0xD0
[test]IAPPGM i:0xFC, nSz:500, Sum:0x3E, 0x3E, nAddr:0, MsgId:0xD0
RMsgId:0xD0
[test]IAPPGM i:0xFC, nSz:500, Sum:0x3E, 0x3E, nAddr:0, MsgId:0xD0
RMsgId:0xD0
[test]IAPPGM i:0xFC, nSz:500, Sum:0x3E, 0x3E, nAddr:0, MsgId:0xD0
RMsgId:0xD0
[test]IAPPGM i:0xFC, nSz:500, Sum:0x3E, 0x3E, nAddr:0, MsgId:0xD0
一直重復(fù).