Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN Bus and Labview RT

I have a device which outputs CAN J1939.  I would like to get my Labview Real Time target to recieve messages from this device.  I am using SIT for the model on the real time target.  I created several CAN channels with the correct arbitration ID of the specific data I want using MAX and signals can be read from the device correctly using the test panels in MAX.  I configured my RT target using the SIT connection manager.  I configured the CAN PXI card that is in the target using the CAN channel configuration file I created in MAX.  For some reason, I cannot get the RT target to read the messages output by the device as I could in MAX.  Is this not supported with Labview RT or is it something else?  What am I doing wrong?

 

Thanks,

 

Eric

0 Kudos
Message 1 of 11
(10,280 Views)

Hi Eric,

 

Here is a good KB to double check that your doing every thing correctly.

 

Setup an NI-CAN Real-Time Application in MAX

http://digital.ni.com/public.nsf/allkb/D2D8B947369F453986256F89006F40B0?OpenDocument

 

When you say you CAN can't get it to read, does it give you errors or juts not read anything?

 

Thanks

Scott

Applications Engineer
National Instruments
0 Kudos
Message 2 of 11
(10,265 Views)

It does not give errors, it just reads zero.  That document is more for just Labview realtime.  I am using SIT for my model.  In the SIT connection manager, there is a field when setting up hardware that asks for a configuration file.  I have created these files by specifying messages and channels in MAX and then saving them to file.  It works if the arbitration ID is 0x0 to just send messages from one thing to another, but I have a device which uses the J1939 protocol (arbitration ID is 0x18FFDB3F).  I created channels in MAX that can recieve this information (I was using the test panels in MAX to see if it worked and it does), but when I specify the configuration file in SIT connection manager, it doesn't seem to work.  I just get a zero as a response.

 

-Eric

0 Kudos
Message 3 of 11
(10,262 Views)

Hi Eric,


Let's start with the basics:

 

  • What version of LabVIEW and SIT are you using.
  • What real time target are you developing on?
  • What CAN card are you using?
  • Have you tried a wrap back test (connecting CAN0 to CAN1 if you have a two port card) with a simple input and output type of model?
  • How are you linking your CAN message to the model?
Joshua B.
National Instruments
0 Kudos
Message 4 of 11
(10,220 Views)

I am using a PXI-8106 controller with a PXI-8464 CAN/XS Series 2 card.  I am using Labview 8.6.1.  I have tried a wrap back test with the J1939 arbitration ID I want (0x18FFDB3F) and I still get no response, just like with the device I am trying to communicate with.  The wrap back test works with and ID of 0x0.  If I just use the 0x18FFDB3F ID in MAX, I do get a response and it is correct.  Is J1939 not supported in Labview RT and/or SIT?I am linking the message to the model through SIT Connection Manager.  I save the configuration as a .ncd file in MAX and then open that file in the configure hardware section.

 

-Eric

0 Kudos
Message 5 of 11
(10,210 Views)

Hi Eric,

 

I got your message this afternoon. I will attempt to reproduce your issue on Wednesday. Stay tuned!

Joshua B.
National Instruments
0 Kudos
Message 6 of 11
(10,190 Views)

It appears that my wrap back test is no longer working with any configuration in RT.  I had done it before (before I started trying the J1939 configuration out) and it had worked with the 0x0 arbitration ID and 11 bit frame format.  Now it does not work for either 11 bit or 29 bit.  The CAN card still works correctly in MAX for all configurations.  Does baud rate need to be changed when running in RT?  My device outputs at 250k.  I'm not sure if that is relevant.

 

-Eric

0 Kudos
Message 7 of 11
(10,182 Views)

Eric,  you may need to set the default CAN interface baud rates in MAX if you are not explicitly setting it in your program.   The configuration is slightly different from DAQ cards and people often miss it. In MAX, look under Tools -> NI-CAN -> RT Hardware Configuration. 

 

 

 

--Paul Mandeltort
Automotive and Industrial Communications Product Marketing
0 Kudos
Message 8 of 11
(10,146 Views)

Hi Eric,

 

What example program are you using, can you post screenshots of the MAX configuration for the RT target that Paul had mentioned? Also, can you post the CAN database that you are targeting with the SIT Connection Manger? It would probably be also a good idea to post the MDL and DLL that you are using with SIT too.

Joshua B.
National Instruments
0 Kudos
Message 9 of 11
(10,129 Views)

Here is everything I'm using to try the loop back test.  Port 1 and port 2 are connected through a serial cable.

 

-Eric

0 Kudos
Message 10 of 11
(10,118 Views)