你好, 我司ch563q的案子,目前正参考/exam/IAP_DEMO 在做 软件升级功能,
数据是从主板(usb host)传送到ch563(usb device), 每次数据长度是500 Bytes,
FLASH_ROM_ERASE是没问题的,但是第一个FLASH_ROM_WRITE就一直是返回 0xFC,
不晓得这个返回值是什么意思 ? 麻烦帮忙看下,谢谢。
以下是我们代码和打印信息:
{
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
一直重复.