Page 1 of 1

Diagnostic response not received

Posted: Mon 16. Mar 2020, 11:52
by ciprian
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!

Re: Diagnostic response not received

Posted: Mon 16. Mar 2020, 12:09
by M.Heidemann
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

Re: Diagnostic response not received

Posted: Fri 20. Mar 2020, 10:47
by ciprian
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!

Re: Diagnostic response not received

Posted: Fri 20. Mar 2020, 12:53
by M.Maidhof
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

Re: Diagnostic response not received

Posted: Tue 5. Nov 2024, 11:37
by Gyula.L
Hello,

is there any way after calling the Write() function to check, whether the frame has been physically transmitted?

Write() places the data into the output queue, so it is not yet transmitted, when leaving the function.

Or do I need to wait, let's say 20 ms before change to SlaveResponse?

Re: Diagnostic response not received

Posted: Tue 5. Nov 2024, 12:00
by M.Maidhof
Hi,

use LIN_Read() to see the correct LIN frames or errors on the LIN after your Write() commands

regards

Michael