S32K144

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K144

756 Views
zq1
Contributor III

i am using  lin api sdk to build my project  ,but sometimes , send data will enter LIN_READBACK_ERROR,

below  is my lincallback:

LIN_DRV_Init(INST_LIN1, &lin1_InitConfig0, &lin1_State);
LIN_DRV_InstallCallback(INST_LIN1, LINCallBack);
LIN_DRV_EnableIRQ(INST_LIN1);
INT_SYS_EnableIRQ(LPUART2_RxTx_IRQn);
INT_SYS_EnableIRQGlobal();

void LINCallBack(uint32_t instance, void * linState)
{
  static LIN_Message_T Lin_msg_temp ={0};
(void)instance;
const lin_state_t * linCurrentState = linState;
Lin_msg_temp.id = linCurrentState->currentId;
status_t result = STATUS_UNSUPPORTED;
 
switch (linCurrentState->currentEventId)
{
case LIN_PID_OK:  //正确帧头事件
if(0x3C == Lin_msg_temp.id)
{
//LIN_DRV_SetTimeoutCounter(INST_LIN1, 8);
result = LIN_DRV_ReceiveFrameData(INST_LIN1, g_aLINRxBuf, 8u);
if(result != STATUS_SUCCESS)
{
break;
}
}
   else if(0x3D == Lin_msg_temp.id)
{
 
            LIN_UDS_Tx_Processor();
//     LIN_DRV_SendFrameData(INST_LIN1,UnSegDataReq.MessageTxData, UnSegDataReq.Length);
// LIN_DRV_SetTimeoutCounter(INST_LIN1, 8);
// result = LIN_DRV_SendFrameData(INST_LIN1, g_aLINTxBuf, sizeof(g_aLINTxBuf));
}
break;
case LIN_TX_COMPLETED:
{
if(tx_finished == true)
{
LIN_UDS_NL_USData_Con(&UnSegDataCon,&UnSegDataReq, pci_type);
tx_finished =false;
// pci_type = Unknown;
}
 
}
break;
case LIN_RX_COMPLETED:
{
for(uint8 i = 0;i<sizeof(g_aLINRxBuf);i++)
{
Lin_msg_temp.data[i] = g_aLINRxBuf[i];
}
Lin_msg_temp.length = linCurrentState->rxSize;
LIN_UDS_Receive_Message_FI(Lin_msg_temp);
}
break;
case LIN_CHECKSUM_ERROR:
{
num++;
}
break;
case LIN_FRAME_ERROR:
{
 
}
break;
case LIN_READBACK_ERROR:
{
num--;
}
case LIN_WAKEUP_SIGNAL:
{
 
}
break;
default:
  /* do nothing */
break;
}
}
 
i want to know how to deal with the LIN_READBACK_ERROR and why LIN_READBACK_ERROR occurs
hope you人reply

 

Tags (1)
0 Kudos
Reply
2 Replies

718 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

for LIN transmitted byte is monitored back, if not the same, a transmission is stopped and LIN state is set to idle. The LIN_READBACK_ERROR event is called when LIN master is sending payload/checksum and received byte is not the same as transmitted one. Driver finally sets current state to IDLE after returning from callback.

BR, Petr

0 Kudos
Reply

600 Views
zq1
Contributor III
thank you very much, but, i want to konw how to solve this problem,hope your reply
0 Kudos
Reply