S32K116 LIN Diagnostic Example

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

S32K116 LIN Diagnostic Example

Jump to solution
5,124 Views
chaitanya_kalyani
Contributor III

Hello,

 

I need to implement some UDS diagnostic services for project. For that I need LIN diagnostic example code.

 

I checked but not able to implement diagnostic services. Can you please provide me sample code for LIN diagnostic.

 

My device is slave and I have implemented below code for receiving data and data is receiving correctly 

chaitanya_kalya_1-1607520342393.png

Below is for response and LIN_DRV_SendFrameData is returning success but not getting data on CANOe tool it just showing sending frame.

chaitanya_kalya_0-1607520274514.png

chaitanya_kalya_2-1607520486517.png

On CANOe I selected while sending 0x3C with Header and response.

 

Thank you in advance.

0 Kudos
Reply
1 Solution
5,114 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

 

I think a S32DS demo example "lin_slave_baremetal_s32kxx" can be modified to handle MasterReq (0x3C) and SlaveResp (0x3D) diagnostic frames. The callback can be then

 

switch (lin1_State->currentEventId)
{
case LIN_PID_OK:
              /* Set timeout */
              LIN_DRV_SetTimeoutCounter(INST_LIN1, TIMEOUT);

/* If ID is 0x3C, slave node will receive data from master node */
if(0x3C == lin1_State->currentId)
{
    /* Call to Receive Frame DATA Function */
    LIN_DRV_ReceiveFrameData(INST_LIN1, rxBuff, sizeof(rxBuff));
}

/* If ID is 0x3D, slave node will send data */
if(0x3D == lin1_State->currentId)
{
     /* Call to Send Frame DATA Function */
     LIN_DRV_SendFrameData(INST_LIN1, txBuff2, sizeof(txBuff2));
}

From CANoe you first send MasterReq (0x3C) frame and later SlaveResp (0x3D) header to which slave should respond.

 

BR, Petr

View solution in original post

0 Kudos
Reply
4 Replies
1,092 Views
Mithra
Contributor I
Hi Chaitanya Kalyani,
                                                                                                                                                                         I need to implement some DID's in UDS stack. So please can you guide me, how to implement this.                                                                                                                                                                        Thanks,                                                                                                                                                              Ani
 
0 Kudos
Reply
5,072 Views
chaitanya_kalyani
Contributor III

Hello @PetrS ,

 

As per your suggestion I updated code and getting response but value is getting updated for only one time from next time getting value as 0x0.

 

chaitanya_kalya_0-1608527517142.png

I am sending data through CANOe

 

chaitanya_kalya_1-1608527576430.png

 

We are working on LIN based bootloader and we need to solve this issue ASAP.

 

Quick response highly appreciated.

 

Thank you in advance.

0 Kudos
Reply
5,115 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

 

I think a S32DS demo example "lin_slave_baremetal_s32kxx" can be modified to handle MasterReq (0x3C) and SlaveResp (0x3D) diagnostic frames. The callback can be then

 

switch (lin1_State->currentEventId)
{
case LIN_PID_OK:
              /* Set timeout */
              LIN_DRV_SetTimeoutCounter(INST_LIN1, TIMEOUT);

/* If ID is 0x3C, slave node will receive data from master node */
if(0x3C == lin1_State->currentId)
{
    /* Call to Receive Frame DATA Function */
    LIN_DRV_ReceiveFrameData(INST_LIN1, rxBuff, sizeof(rxBuff));
}

/* If ID is 0x3D, slave node will send data */
if(0x3D == lin1_State->currentId)
{
     /* Call to Send Frame DATA Function */
     LIN_DRV_SendFrameData(INST_LIN1, txBuff2, sizeof(txBuff2));
}

From CANoe you first send MasterReq (0x3C) frame and later SlaveResp (0x3D) header to which slave should respond.

 

BR, Petr

0 Kudos
Reply
4,275 Views
pankajprasad100
Contributor III

Hi,

Just modified the code while sending the Master request - frame, inside the code buffers are not updating same as @chaitanya_kalyani 

But if I send 3D-frame I am getting the response.

Need help to  update the buffer while sending the Master request - frame.

0 Kudos
Reply