LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading messages from CAN bus using NI 9862

Solved!
Go to solution

I've tried signal input in single point and waveform mode. In single point, I get the default value, while in waveform I get an output of zero.

 

To give you a better idea about the configuration: each ECU is transmitting five messages, and each message contains six 10 bit signals. I created the XNET sessions in the project window and ran a blank FPGA. Within the properties window for the sessions, I selected the correct interface and database file and added the signals stored in the dbc to the session list. 

0 Kudos
Message 11 of 16
(1,609 Views)

That lines up with the behavior I would expect from both sessions if no signals/frames were being received. You mentioned you had to write some code to see frames to begin with. What additional set up and steps did you have to take?

Does your device require any commands or additional set up before it starts transmitting? For example, some devices require remote frames before they will begin transmitting. 

Charlie J.
National Instruments
0 Kudos
Message 12 of 16
(1,608 Views)

From what I can tell, frames are being received. I've attached some pictures of a simplified version of my set up to hopefully shed some light on the problem. As the block diagram shows, I have two sessions created in the project window and dragged onto the block diagram. "CAN IN" is a frame input in stream mode. Reading this session gives an array of frames that appear as expected. They are receiving CAN frames with the expected IDs and the payload field shows the expected activity.

 

The problem seems to come when I try to use a signal session to extract the individual signals. "single point in" is a signal input in single point mode. As can be seen in the screenshot, it calls an existing database. For simplicity, I only added the first 6 signals to the session, although similar results come from adding all of the signals. Reading from this session returns a 6 cell array of the same constant value(about -1.73). I am not sure where this value could be coming from as the default value is set to 0 on the database file. Just to see what would happen, I changed the default value to 99 and the output changed to about 98.5.

 

I know labview is supposed to parse the bits received based on the information contained in the database file but I do not completely understand how this occurs. Still, based on the raw frames I am recieving, I would not expect the signal values to be constant.

 

Also, if it makes a difference, the database file was created by another engineer with third party software. He is not familiar with NI software but he did create the database to match the output of the ECUs (which he programmed). Is it possible that labview requires information from the database that he would have not known to include?

0 Kudos
Message 13 of 16
(1,580 Views)
Solution
Accepted by topic author daqrookie15

Everything looks set up properly in your code, and I don't see any issues there.

One thing to check, though it's likely a strecth: I noticed in your database file, Arbitration IDs for the frames are being shown in Decimal notation (note the small letter "d" in your dbc2.png). The LabVIEW Indicator Cluster for frames typically has this as Hexadecimal value and not decimal. Can you confirm that the frames coming in as you expect are showing this value in the same format as your database for comparison? 

There should be an "x" for hex and a "d" for decimal. You can change this representation by left-clicking on the letter. 

Charlie J.
National Instruments
0 Kudos
Message 14 of 16
(1,545 Views)

That was it! It turns out that the ID's were hex 110, 111..etc but the database was looking for dec 110, 111...etc. Changing the ID's representation to hex in the database and then readjusting the value to what the ECU's were transmitting fixed the problem and now everything is working as it should. 

 

Thank you for the help.

0 Kudos
Message 15 of 16
(1,541 Views)

No problem! Glad that resolved the behavior, as I wasn't sure what else would be happening.

Charlie J.
National Instruments
0 Kudos
Message 16 of 16
(1,532 Views)