S32K

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

S32K

665 Views
zq1
Contributor III

i am building a project with lpuart_lin ,using RTD,but i did not found the api about receive data, what i can find like this only in Lpuart_Lin_Ip.c,but they are static ,

zq1_0-1704870016051.png

what api function could i use to receive data or send data?

thank you

0 Kudos
7 Replies

649 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @zq1,

Please specify the MCU part.

Is the MCU used as LIN Master or Slave?

The static function you mentioned is called from the LIN interrupt handler, and it calls a callback function at the end.

It was discussed here:

https://community.nxp.com/t5/S32K/S32K148-EVB-How-to-send-recieve-LIN-bus-message-with-Real-Time/m-p...

 

Regards,

Daniel

0 Kudos

648 Views
zq1
Contributor III

thank you very much, the mcu is S32K312,   s32k1XX i had finished my project 3 months ago,the S32K3 is much different with S32K1xx, 

0 Kudos

617 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @zq1,

There are S32K3xx RTD examples you can refer to.

As I said, you need to use the callback.

 

Regards,

Daniel

 

0 Kudos

508 Views
zq1
Contributor III

first of all, thank you very much, but there is still a problem i did not work out, my lpuart_lin can send frame,but can not receive data,the case LPUART_LIN_IP_RX_COMPLETED can not enter

 

void LIN_CallBack(const uint8 Instance, const Lpuart_Lin_Ip_StateStructType *LinState)
{
(void)Instance;
//const Lpuart_Lin_Ip_StateStructType * linCurrentState = LinState;
Lin_msg_temp.id = LinState->CurrentPid & 0x3f;
//Lpuart_Lin_Ip_StateStructType 没有id的成员,这里需要搞清楚pid与id的关系
switch (LinState->CurrentEventId)
{
case LPUART_LIN_IP_RECV_HEADER_OK:
if(0x3C == Lin_msg_temp.id)
{
memcpy(g_aLINRxBuf,LinState->RxBuff,LinState->CntByte);
num++;
}
    else if(0x3D == Lin_msg_temp.id)
{
 
    Lpuart_Lin_Ip_SendFrame(INST_LIN2, &LinLpuartPdu);
    num++;
}
   break;
 
case LPUART_LIN_IP_RX_COMPLETED:
{
memcpy(g_aLINRxBuf,LinState->RxBuff,LinState->CntByte);
 
Lin_msg_temp.length = LinState->CntByte;
num++;
}
break;
 
case LPUART_LIN_IP_TX_COMPLETED:
{
//clear tx buffer
num++;
}
break;
 
default:
  /* do nothing */
break;
}
}
 
in rtd lpuart_lin_Ip.c,it can not enter  case LPUART_LIN_IP_NODE_STATE_RECV_DATA:
zq1_0-1706145920080.png

 

0 Kudos

439 Views
cuongnguyenphu
NXP Employee
NXP Employee

Could you confirm my understanding about your issue as below diagram:

cuongnguyenphu_0-1706690227779.png

Your LIN frame is sent from MASTER, and the Response field is from Master
In Slave side, you used LIN_Callback() to receive data. And your current issue is this LIN_Callback cannot reach LPUART_LIN_IP_RX_COMPLETED state?

Furthermore, I saw in your code that after receive Header, you will call this function to store data:
Lpuart_Lin_Ip_SendFrame(INST_LIN2, &LinLpuartPdu);

What is parameters of LinLpuartPdu? Because I expect that LinLpUartPdu should have parameter LIN_FRAMERESPONSE_RX to receive data

 

0 Kudos

405 Views
zq1
Contributor III

Lpuart_Lin_Ip_SendFrame(INST_LIN2, &LinLpuartPdu);  this  function is to send data?not receive data?

 

0 Kudos

402 Views
cuongnguyenphu
NXP Employee
NXP Employee

This function receive data when LinLpuartPdu has parameter LIN_FRAMERESPONSE_RX

0 Kudos