Diagnostic response not received

The free LIN software API (Application Programming Interface) for Windows® (only for usage with the PCAN-USB Pro CAN/LIN interface)
Post Reply
ciprian
Posts: 2
Joined: Mon 16. Mar 2020, 11:37

Diagnostic response not received

Post by ciprian » Mon 16. Mar 2020, 11:52

Hello,

I have a PLIN hardware use I want to use as a Master and a pcb used as Slave.
I'm trying to use the APIs to send a diagnostic frame and also receive the response from the slave.
I made the following steps:
Checking the HW available. [using LIN_GetAvailableHardware]
Client registration. [using LIN_RegisterClient]
Client connection. [using LIN_ConnectClient]
Check the LIN bus. (Active) [using LIN_GetStatus]
Schedule a SlaveResponse slot with FrameId[0] = 0x3D [using LIN_SetSchedule]
Start the schedule slot. [using LIN_StartSchedule]
Write the message. -> Working, checked on the slave side. [using LIN_write]
But when I'm trying to read the response I never receive the correct response and usually I receive CC values.. [using LIN_read]

What I'm doing wrong? :(

Thanks!
Last edited by M.Heidemann on Mon 16. Mar 2020, 15:26, edited 1 time in total.
Reason: Moved topic to appropiate sub-forum

M.Heidemann
Sales & Support
Sales & Support
Posts: 222
Joined: Fri 20. Sep 2019, 13:31

Re: Diagnostic response not received

Post by M.Heidemann » Mon 16. Mar 2020, 12:09

Hello,

please note that LIN_Read() will return the protected frame identifier, and not the LIN frame ID. See LIN spec. for more details on how to convert protected ID to LIN frame ID (Example: LIN_frame_id = RcvMessage.FrameId & 0x3F)

Please report back to me , if this was the issue at hand.

Best Regards

Marvin

ciprian
Posts: 2
Joined: Mon 16. Mar 2020, 11:37

Re: Diagnostic response not received

Post by ciprian » Fri 20. Mar 2020, 10:47

Hello again,

After I succesfully manage to Register->Connect->Configure a client and the bus is active..
What should I do next in order to be able to receive a diagnostic response?

What I did:
1. Schedule a Slave response Slot.
2. Start the Schedule Slot.
3. Send diagnostic frame.
4. Read the diagnostic frame. [the response is send by the Slave but I don't receive anything when using LIN_read]

How is the correct way to define a schedule slot used as Slave Response?
pSchedule.FrameId[0..7] set to 0?

Thanks!

M.Maidhof
Support
Support
Posts: 1269
Joined: Wed 22. Sep 2010, 14:00

Re: Diagnostic response not received

Post by M.Maidhof » Fri 20. Mar 2020, 12:53

Hi,

a diagnostic request on LIN is initiate by a 0x3C master requests (publisher), followed by one or more 0x3D slave response frames (subscriber). So the first response will tell you if it is a single frame or a first frame for additional consecutive frames (ISO-TP or UDS on LIN). So the internal scheduler will make no sense for LIN Diagnostic frames, it will be better to use the LIN_Write command to send out the needed frames with the timing given by the ldf for diag frames. Example:

Code: Select all

	   	   
	   	   	// Send 0x3C publisher frame: RDBI for Node 0x02 DID 0x1077
	   	   	    myTXmsg.FrameId = 0x3C;  //protected ID! 
                            myTXmsg.Length = 8;
                            myTXmsg.Direction = Peak.Lin.TLINDirection.dirPublisher;
                            myTXmsg.ChecksumType = Peak.Lin.TLINChecksumType.cstClassic;
                            myTXmsg.Data = new byte[8];
                            myTXmsg.Data[0] = 0x02;
                            myTXmsg.Data[1] = 0x03;
                            myTXmsg.Data[2] = 0x22;
                            myTXmsg.Data[3] = 0x10;
                            myTXmsg.Data[4] = 0x77;
                            myTXmsg.Data[5] = 0xFF;
                            myTXmsg.Data[6] = 0xFF;
                            myTXmsg.Data[7] = 0xFF;
                            if (my_hClient != 0)
                                my_LINErr = Peak.Lin.PLinApi.Write(my_hClient, my_hHw1, ref myTXmsg);
                                
                                
                                
and after 10ms you send the 3D subscriber:

Code: Select all

			    // Send 0x3D subscriber
			    myTXmsg.FrameId = 0x7D;  //protected ID!
                            myTXmsg.Length = 8;
                            myTXmsg.Direction = Peak.Lin.TLINDirection.dirSubscriber;
                            myTXmsg.ChecksumType = Peak.Lin.TLINChecksumType.cstClassic;
                            if (my_hClient != 0)
                                my_LINErr = Peak.Lin.PLinApi.Write(my_hClient, my_hHw1, ref myTXmsg);
with LIN_Read you will get the results of the 3D subscriber on ID 0x7D

regards

Michael

Post Reply