Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send HEADER on LIN bus using NI-XNET

Hello,

I am using the NI-9860 onto a cDAQ-9189 and I am trying to do 2 things to let me communicate with my slave device (sensor) using XNET:

 

  • sending a full frames to the sensor. I can do it thanks to the "LIN Frame Output single Point.vi" example and playing with the database NIXNET_exampleLDF.ldf, in which I must change the ID, to make it match with my sensor.
  • sending a header to let my slave answer and send me a response. How to just send the header without any payloads ? and is there any example available to let me read the response of the slave just after the send of that header?

Also, as an additionnal question, as on XNET we need to open a session (one to write, one to read), what would be the best way (structure of diagram) to let me send one full frame followed by sending a header followed by a reading of the slave reponse ?

 

I have thought about the sequence structure for this (3 differents strucutres for each sessions), but it might be something better ?

 

Thank you in advance 🙂

 

0 Kudos
Message 1 of 5
(1,931 Views)

You can use a Input Session as the LIN Master and loads a schedule which contains only slave payload. Please see the attached example.

Senior Technical Support Engineer | CLD CTA | NI


DISCLAIMER: The attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

0 Kudos
Message 2 of 5
(1,908 Views)

Hello ZY_Ong,

I have tried to launch your example as explained (first open database editor then open CarWindow.xml) but when I launch the VI, it shows 1074384560 error.
Looking on Knowledge NI web page , I see that either I should load the alias (which didn't work, but I am not sure that I made it well) either add the alias on the database editor, which seems already well defined.

 

Meanwhile, I have tried to develop my own VI to:

    1) send a frames from the master to the slave, which is used to kind of wake up the device and specify which datas it will wait for when It will send then the header

    2) send a Header by the master and read the slave response using a piece your Carwindow example, using my own LDF.

 

Here is the screenshot of the front pannel:

 

TeraEngineer_0-1642505424436.png

The diagram screenshot:

TeraEngineer_1-1642505521374.png

TeraEngineer_2-1642505544593.png

 

The database screenshot:

 

TeraEngineer_3-1642506354920.png

 

But when I spy the LIN bus thanks to my other LIN port, I see the Master frame but I don't see any header frame sent.. So I guess there is a misunderstanding somewhere. Could you explain please ?

 

 

0 Kudos
Message 3 of 5
(1,890 Views)

Once you have registered the database alias, you might need to right click on the Frame List and Schedule to select the newly registered database. The original database file contains DUT name so I renamed it, but it will break the compatibility with the VI.

The sending of header is handled by firmware. You only need a Input Session that specifies a schedule, if you only want to read the payload from slave.

If you want to send a LIN wake frame, please refer to shipping example at Hardware Input and Output >> LIN >> NI-XNET >> Sleep and Wakeup

Senior Technical Support Engineer | CLD CTA | NI


DISCLAIMER: The attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

0 Kudos
Message 4 of 5
(1,876 Views)

@ZY_Ong  a écrit :

The sending of header is handled by firmware. You only need a Input Session that specifies a schedule, if you only want to read the payload from slave.

If you want to send a LIN wake frame, please refer to shipping example at Hardware Input and Output >> LIN >> NI-XNET >> Sleep and Wakeup


So I guess that the vi I have "developped" (it takes the "LIN frame Output Single Point.vi example to send the full master frame and your "CarWindow_LIN_Master.vi" example to then send the master header and read the slave response)  should work (see screenshots in my previous email, you will find the .vi and the ldf in attachment to let you kindly check), souldn't it ?

It seems not..it only send the Master full frames but I don't see any header sent then, spying the LIN bus thanks to the second LIN bus monitor. Is that normal to not see any header sent?

 

Concerning the database alias, I did select the right frame list and schedule but the error is still here.

Coud you be more explicit by "Once you have registered the database alias" ? You mean just load it into the database editor as we talked about?

 

0 Kudos
Message 5 of 5
(1,863 Views)