From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9862 CAN sending J1939 message to a non-Ni device

Solved!
Go to solution

Hi everyone, 

I’m new to NI CAN and try to communicate CAN 9862 (high speed with NI 9171 chassis) with a 3rd party device, a steering column. I'm having trouble sending message of J1939 format to the steering column. 

The steering column transmits the torque and force data with its built in sensors. After proper connection, the steering column, with CAN messages encoded, will send the CAN data to the CAN bus automatically when turn on the power supply.  I can observe the data on NI-Bus Monitor without loading database files.

Also, on the other side, I need to send a message to the CAN bus to control the mode of the steering column. The message is in J1939 format. I need to change 1 bit of the message data, actually bit 7 of byte 5 to be 0 or 1 to switch the mode and then receive the data that the steering column is transmitting. There will be significant difference in the torque data received if the bit value is 1.  

To achieve this, I created 2 database files using the NI-Max, under Data Neighborhood, CAN channels, setting the specific bit value to be 0 or 1 in the two database files.

I used the labview NI-XNET example, CAN Frame Input Stream.vi to read the data, loading the database file in the CAN Cluster I/O. However, after I tried to load the 2 database files in two trials, I didn’t notice any difference in the output data, although the program ran without error.

What’s more, I tried the J1939 NI CAN Frame example.vi in the 1939 Multi Packet Frame folder, but not sure about the “Current Device Address” input. Is that the same as the source address, the last byte Arbitration ID?

https://forums.ni.com/t5/Example-Code/J1939-Transport-Protocol-Reference-Example/ta-p/3984291

 

My questions are:

  1. Is creating database file the correct way to generate the message to the CAN bus?
  2. Also, for the J1939 message, is the example CAN Frame Input Stream.vi suitable for this situation. Will loading the database file actually send the message?
  3. Besides, for the J1939 NI CAN Frame example.vi , how to specify the “Current Device Address”, and should I enter the message I intended to send at the “Data to send ”cluster.

The CAN Frame Input Stream.vi and the message to send are attached.

Thanks so much for your patience!

 

Hardware and software configuration.
Download All
0 Kudos
Message 1 of 13
(10,575 Views)
Solution
Accepted by topic author Russell89

Hi there Russell,

 

First, let me make sure I have a proper understanding of your situation.

 

You are looking to send a J1939 message to the steering column. That message will be read by the steering column, and it will send data depending on the mode that was set. You then want to read in that data. Please tell me if I got any of that wrong.

 

Ok, now to answer your questions

  1. Yes, creating the database is the correct way to send and receive messages from the CAN bus. You should only need one database however. What is the expected data that you are receiving from the steering column for both modes? Are you interpreting that data differently depending on mode?
  2. The "CAN Frame Input Stream.vi" is for reading data from the bus. To send messages, I would recommend in your case to use the "CAN Frame Output Single Point.vi" to send the mode message. This sends one CAN Frame to the bus at a time. You can find this in the example finder. You could use the "J1939 Frame to NI-XNET CAN Frame.vi" to convert your J1939 data to XNET Frame data to make things easier.
  3. It looks like this example continually reads frames from the bus and displays them in INPUT. You can also send frames by entering a J1939 message in the OUTPUT and pressing send message. The device address should be the arbitration ID.

I would try first using the "J1939 NI CAN Frame example.vi" Then if you are successful, you can move on to using the "CAN Frame Output Single Point.vi" to set the mode, and use NI-Bus Monitor to check that the mode is being set correctly. Finally, use the "CAN Frame Input Stream.vi" to read the frames from the steering column and interpret them correctly.

 

Thanks

Daniel C.
Applications Engineer
National Instruments
Message 2 of 13
(10,533 Views)

Hi Daniel,
Thanks for your answer. You are right that I'm looking to sending a J1939 message to the steering column, which will be read by the steering column and turn its mode. On the other side, the steering column will output the data depending on its mode. When the 47th bit of the message is 0, the steering column is in an "easy mode" with less torque output, and if the bit value is 1, it will be a "hard mode" with bigger torque.


To clarify the questions you mentioned:
1. I'm interpreting the data of both modes in the same way. I'm expecting to see the difference of the data bewteen the two modes the steering column sends. The first two bytes of the payload represents the steering torque output, which are supposed to be different under the two modes. Although I know there might be other factors resulting the output torque, I'm wondering if there is a way to check if the message is successfully received by the steering column.

 

2. Also, I've tried the example J1939 NI CAN Frame example.vi, entering the Input interface according to the NI-MAX's device and interfaces, and the Address is based on the Arbitration ID. However, an error occurred: NI-CAN: (Hex 0xBFF62023) The Interface is invalid or unknown. Solutions: Verify that the interface is assigned to a specific port within the Devices and Interfaces branch of the Measurement and Automation Explorer (MAX). Since I've set the interface value to be the same as that of NI MAX, I'm wondering how to fix this and continue.

 

In addition, I'm having some very basic questions: for the J1939 message itself, I only need to specify one bit, bit 47 and the other bits value are either reserved or undefined. So when creating the database, can I only define that bit's value without defining the other 63 bits? Similarly, In the NI example VIs, to send the Frame to the steering column, can I enter the only one byte's value (byte 5, containing bit47) without specifying the other bytes, or all the 8 bytes of the payload need to be specified?

 

Thanks so much!

Hardware and software configuration.
0 Kudos
Message 3 of 13
(10,505 Views)

Hey Russell,

 

Are you using NI-CAN driver or NI-XNET drivers? I was assuming that you are using XNET.

 

1. CAN Frames have an acknowledgement bit. The sending side will check for the acknowledgement, and re-send the message if there is no acknowledgement. See this whitepaper: https://www.ni.com/en/shop/seamlessly-connect-to-third-party-devices-and-supervisory-system/controll...

 

2. Which example was this again? I didn't see it in any of the links in your previous post. Sounds like the error is coming from NI-CAN, but you should be using NI-XNET driver. In one of the links you provided, I found the program "J1939 NI-XNET Frame Example.vi". Are you using this VI or something different? This is the program I was referring to in my previous post instead of "J1939 NI CAN Frame example.vi". Sorry for the confusion. If you could post the VI that you are currently using, as well as the source, that would be really helpful! 

 

3. Regarding bits and the database: The database just tells how to interpret the data. If you only define one byte's value, the other bytes will simply be ignored. There's no need to define bytes that have no meaning.

Daniel C.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 13
(10,451 Views)

Hi Daniel,

I just realized that I was using the 1939 NI CAN Frame example.vi, instead of the 1939 NI-XNET Frame Example.vi. Thanks for pointing it out. Now, after running the 1939 NI-XNET Frame Example.vi, I didn't get the above error message anymore. I enter the message at the OUTPUT block, and select SEND MESSAGE, and when I pressed the STOP button, however, I didn't get the frame at the INPUT block.  The INPUT block is still empty. So I"m wondering how I should set the option before running it, especially the J1939 Stop FGV. vi's "reset, read, write" options.

Thanks very much!

 

 

Hardware and software configuration.
0 Kudos
Message 5 of 13
(10,426 Views)

That example VI is designed to continuously monitor the input data. Did you press the stop button immediately after sending the message? You don't have to do that; just leave it running to see if the steering column sends a message back. Is the steering column supposed to immediately respond with a message? You shouldn't have to do anything with that Stop FGV vi.

Daniel C.
Applications Engineer
National Instruments
0 Kudos
Message 6 of 13
(10,406 Views)

Hi Daniel,

Thanks for all your detailed reply. I'm wondering if this example works for the cdaq, ni-9171 instead of a compactRIO?

Thanks very much!

 

Hardware and software configuration.
0 Kudos
Message 7 of 13
(10,281 Views)

You're welcome! It should work fine with the module in a 9171, just make sure you have DAQmx drivers installed!

Daniel C.
Applications Engineer
National Instruments
0 Kudos
Message 8 of 13
(10,274 Views)

Hi Daniel,

Finally I achieved this by using the NI bus monitor, transmitting single frame option.

Thanks!

Hardware and software configuration.
0 Kudos
Message 9 of 13
(10,255 Views)

Hello Daniel,

 

I am having similar development challenges and downloaded the attached VI to work out my problem.  When loading, there are a number of missing files.  Can you package all the required VIs and Controls and send to me?

 

Thank you

0 Kudos
Message 10 of 13
(9,073 Views)