Part Number: TDA2HG
Hi,
My vsionSDK verision: 3.05.
When I send and receive MCSPI on interrupt and slave mode with 96byte pre-frame. The receive frame always fine. But send frame will always mismatch.
If I send:
frame1: 1, 1, 1, ......, 1, 1,1;
frame2: 2, 2, 2, ......, 2, 2, 2;
frame3: 3, 3, 3, ......, 3, 3, 3;
But the master will get:
frame1: 1, 1, 1, ....., 2, 2, 2;(last 32 byte will become 2)
frame2: 2, 2, 2, ......, 3, 3, 3; (last 32 byte will become 3)
And I just called API :
Int32 Utils_mcspiReadWrite(void * fd, UInt8 *pRxBuff,UInt8 *pTxBuff, UInt16 len)
{
UInt32 size = 0U;
Int status = IOM_COMPLETED;
Mcspi_DataParam issueDataparam = {0};
Mcspi_DataParam reclaimDataparam = {0};
Ptr pReclaimDataParam;
Int32 retVal = SYSTEM_LINK_STATUS_SOK;
Utils_mcspiCommHandle commHndl = (Utils_mcspiCommHandle) fd;
commHndl->mcspiIoPrms.timeout = 1000 * 1000;
issueDataparam.inBuffer = (UInt8 *) pRxBuff;
issueDataparam.outBuffer = (UInt8 *) pTxBuff;
issueDataparam.bufLen = (UInt32) len;
if ((UInt32)len > 0x1000U)
{
/* Something is wrong if this condition is met */
Vps_printf(" UTILS_MCSPI: Too large read requested!! Length = %x\r\n",
(UInt32)len);
retVal = SYSTEM_LINK_STATUS_EFAIL;
}
if (retVal == SYSTEM_LINK_STATUS_SOK)
{
size = (UInt32)len;
/* Issue the first & second empty buffers to the input stream */
status = GIO_issue(commHndl->mcspiHandle, &issueDataparam, size,
NULL);
if ((status != IOM_PENDING) && (status != IOM_COMPLETED))
{
Vps_printf(" UTILS_MCSPI: Failed to issue empty buffer to stream!!\r\n");
}
/* Reclaim is done after every issue and buffers are not primed. If
* the buffers are primed next transfer is initialized as soon as
* the first one is completed. We wont be able to ensure transfer
* initializaton on Slave before master for second buffer
*/
pReclaimDataParam = (Ptr) & reclaimDataparam;
status =
GIO_reclaim((GIO_Object *) commHndl->mcspiHandle,
(Ptr *) &pReclaimDataParam,
NULL,
NULL);
if (IOM_COMPLETED != status)
{
Vps_printf(" UTILS_MCSPI: SPI Read/Write Failed: %d\r\n", status);
retVal = SYSTEM_LINK_STATUS_EFAIL;
}
else
{
retVal = (Int32) len;
}
}
return retVal;
}
And since receive is fine, I don't think it have any problem on this configure.
Would you please give me any clue? Thanks a lot!