Hi NXP team,
We are using S32 design studio v3.5.
From the secure NXP website, we obtained the BCC_S32K144_Monitoring_Diagnostics example code.
Since we are utilizing the S32K312 MCU in this case, we modified the low level peripheral drivers of example code to translate the example code to the S32K312. Now the code is compiling without any errors.
However, the following error message appears and we are not receiving any data on TPL communication:
"LPSPI_IP_TIMEOUT".
My code failing in the following function.
bcc_status_t BCC_MCU_TransferTpl(const uint8_t drvInstance, uint8_t txBuf[],
uint8_t rxBuf[], const uint16_t rxTrCnt)
{
(void) drvInstance;
#if defined(TPL)
int32_t rxTimeout;
//status_t error;
Lpspi_Ip_StatusType error;
DevAssert(txBuf != NULL);
DevAssert(rxBuf != NULL);
DevAssert(rxTrCnt > 0);
/* Transmissions at RX and TX SPI occur almost at the same time. Start
* reading (response) at RX SPI first. */
// error = LPSPI_DRV_SlaveTransfer(LPSPISPI_TPL1RX, NULL, rxBuf, rxTrCnt * LPSPI_ALIGNMENT);
error = Lpspi_Ip_SyncTransmit(&SLAVE_EXTERNAL_DEVICE, NULL, rxBuf, 8U , BCC_RX_COM_TIMEOUT_MS);
if (error != LPSPI_IP_STATUS_SUCCESS)
{
return BCC_STATUS_SPI_FAIL;
}
/* Send data via TX SPI. */
//error = LPSPI_DRV_MasterTransferBlocking(LPSPITPLTX, txBuf, NULL,
// LPSPI_ALIGNMENT, BCC_TX_COM_TIMEOUT_MS);
error = Lpspi_Ip_SyncTransmit(&MASTER_EXTERNAL_DEVICE, txBuf, NULL, 8U , BCC_TX_COM_TIMEOUT_MS);
if (error != LPSPI_IP_STATUS_SUCCESS)
{
/* Cancel reception of data. */
// LPSPI_DRV_SlaveAbortTransfer(LPSPISPI_TPL1RX);
Lpspi_Ip_Cancel(Lpspi_Ip_DeviceAttributes_SPI_TPL_RX_Instance_3.Instance);
return (error == LPSPI_IP_TIMEOUT) ? BCC_STATUS_COM_TIMEOUT : BCC_STATUS_SPI_FAIL;
}
/* Wait until RX transmission finished. */
rxTimeout = BCC_RX_COM_TIMEOUT_MS * 1000;
//while ((LPSPI_DRV_SlaveGetTransferStatus(LPSPISPI_TPL1RX, NULL)
// == STATUS_BUSY) && (rxTimeout > 0))
while ((Lpspi_Ip_GetStatus(3) == LPSPI_IP_BUSY) && (rxTimeout > 0))
{
BCC_MCU_WaitUs(10);
rxTimeout -= 10;
if(rxTimeout == 0)
break;
}
/* Cancel data reception if the timeout expires. */
if (rxTimeout <= 0) // (rxTimeout <= 0)
{
// LPSPI_DRV_SlaveAbortTransfer(LPSPISPI_TPL1RX);
Lpspi_Ip_Cancel(Lpspi_Ip_DeviceAttributes_SPI_TPL_RX_Instance_3.Instance);
return BCC_STATUS_COM_TIMEOUT;
}
return BCC_STATUS_SUCCESS;
#elif defined(SPI)
return BCC_STATUS_SPI_FAIL;
#endif
}
Could you please help me to address this problem?
Thanks and regards,
Hareesh