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
Below is for response and LIN_DRV_SendFrameData is returning success but not getting data on CANOe tool it just showing sending frame.
On CANOe I selected while sending 0x3C with Header and response.
Thank you in advance.
Solved! Go to Solution.
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
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.
I am sending data through CANOe
We are working on LIN based bootloader and we need to solve this issue ASAP.
Quick response highly appreciated.
Thank you in advance.
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
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.