Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Diag On Lin (with Automotive Diagnostic Command Set toolkit)

Solved!
Go to solution

1- When I run the examples without changing them, I got this error :

Capture2.PNG

 

2- I can't use Bus Monitor, because Labwindows says that the LIN ressource is used, so I'm using MuxTrace in spy mode to see the LIN frames, and it works. 

 

3-  Yes, and I'm using it in my code. (I have an LDF file)

 

4- Here my code where I set up the handle:

#define LINCluster  		"ADCS_LIN_database"
#define LINClusterRGB  		"LDF_RGB"
#define MasterRequestFrame	""  // "" takes the default value "MasterReq" 
#define SlaveResponseFrame 	""  // "" takes the default value "SlaveResp"

//.
//.
//.

switch (event)
	{
		case EVENT_COMMIT:
			//Get TABPANEL handle and num
			GetPanelHandleFromTabPage (panelHandle, MAIN_PANEL_TABPANEL, 1, &DiagtabHandle);
			
			//Get parameters from user
			GetCtrlVal (DiagtabHandle, TABDIAG_OPEN_DIAG_INTERFACE, cValInterface);
			GetCtrlVal (DiagtabHandle, TABDIAG_OPEN_DIAG_BAUDRATE, cValBaudrate);
			Fmt(&iValBaudrate,"%i<%s",cValBaudrate); 	
strcpy(LINPort, cValInterface);
			
				// NI-XNET:
				strcat(LINPort,"@nixnet");  //Example : LIN1@nixnet
				// Add LDF Cluster
				strcat(LINPort,":");
				strcat(LINPort,LINClusterRGB);  //Example : LIN1@nixnet:ADCS_LIN_database  
				//strcat(LINPort,LINClusterRGB);  //LDF_RGB  
				SetCtrlVal(DiagtabHandle, TABDIAG_TEXT_DB_LIN_LDF, LINPort); //Display LDF DB Source
Delay(1);        
			
				status = ndOpenDiagnosticOnLIN (LINPort, iValBaudrate, NAD, MasterRequestFrame, SlaveResponseFrame, &DiagStruct);
				CheckError ("ndOpenDiagnosticOnLIN", status, Report_temp);

Thanks on advance

0 Kudos
Message 11 of 14
(3,244 Views)

I tested somthing : When I run the function ndUDSReadDataByIdentifier with dataIn[8] = {146, 242, 0, 0, 0, 0, 0, 0} as paramter, I'm supposed to send this frame : //HEX : 92, F2, 00, 00, 00, 00, 00, 00 (this frame is reconized by my device. 

 

So when I send that frame,I can see in the MuxTrace tool that the 2 first byte don't change, but the last 6 byte are updated as my parameter table dataIn[]. 

These 2 first bytes are always equal to 0x01 0x03 what ever I try to send. 

 

I don't see where these byte are initialized. 

 

0 Kudos
Message 12 of 14
(3,241 Views)

IMPORTANT ! 

When I send frames, I noticed that the frame identifier is 0x0C and 0x0D !! or I should see 0x3C and 0x3D as identifier

 

I can't found where I can set up this configuration ! Help please !

 

0 Kudos
Message 13 of 14
(3,227 Views)
Solution
Accepted by topic author HoussamAz

The last problem (0x0C / 0x0D) was because the spyware were using LIN 1.x and not 2.x

 

And finally I used the function "ndDiagnosticService" to send and receive all frames I looked for. 

I'm a little disappointed that the toolkit has no really LIN Diag functions (except the ndOpenDiagnosticOnLIN function).

 

ndDiagnosticService I used is a generic function that need to have an array as input of your frame, and another array to get output result. 

The general error I get is a pointer problem. Now solved. 

 

The only unpleasant thing that I have not understood is that my software send contineousely 0x3D resquest frames (see pic) and I don't know how to stop that. 

I already set up a timer (every 3 seconds) where I send a frame to keep LIN communication. But the thing is that between these frames, I have a resquest frame every 10ms ........ 

 

Capture3.PNG

 

I'm really disappointed because NI didn't developed a personelized LIN Diagnostic ....... 

 

Hope that this help someone else.  

0 Kudos
Message 14 of 14
(3,219 Views)