Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get NI-CAN to send/receive messages via LabVIEW

The gist is I'm replacing a PEAKCan system with a NI-CAN based system.  I can not get the NI-CAN card (monitor nor through LabVIEW) to communicate with our custom hardware/software box.  Our box is based on the Phillips SJA-1000 chip, much like the NI-CAN card.  When our box sends a message, the NI-CAN (MAX) Bus Monitor shows nothing.  When I send a message via LabVIEW vi's (tried both WriteObject and WriteNet), our custom hardware doesn't see the message.

I even tried hooking the PEAKCan adapter straight to one the of CAN Port on the NI-CAN card.  Neither bus monitor sees any traffic from the other.

One thing I noticed missing from the NI-CAN LabVIEW VI's was the ability to create Nets found in the PEAKCan world.  I have a feeling this is the source of the problem, but I'm not sure.  As such, I have the following questions:

1. Is there a way to configure Nets in the NI-CAN world?
2. If not, how do I get the NI-CAN card to talk to our hardware/software through the LabVIEW VI's?

Thanks in advance to anyone who can help,

Mike
0 Kudos
Message 1 of 5
(5,632 Views)
Hi,
 
The Bus Monitor you can run from MAX does only need the correct Baudrate configured with the same Port you are running the Monitor.
The correct baudrate is the rate you are running on your connected device. If the Monitor does not receive any message, it is perhaps the wrong rate or your cable is not connecting the right pins or the termination is wrong.
The termination within your cable depends on the transceiver you are using. If it is a high speed network (both transceivers are High Speed ) you need 120 ohms between CAN_H and CAN_L on both ends of your cable.
If it is a Fault Tolerant network (both transceivers are low speed/fault tolerant) you need a cable which is not terminated at all, because the resistors are on the hardware already.
 
Besides that with the API if you run an example, there is no need to configure anything else. (nets)
 
hope that helps
 
DirkW
Message 2 of 5
(5,617 Views)
Mike,

Basically what you are trying to do should work.

Configuring Nets for PEAK-Can is the equivalent of configuring a NI-CAN Network Interface  Object, except NI-CAN does not help you to store and reuse different configurations.  In that respect I think the PCAN Tools quite surpass the National Instruments Toolbox.


You might check the following:

- does your NI-CAN Card pass its selftest ?  (You can start that in MAX)

- have you configured your CAN port for the correct baudrate ?

- have you connected your device to the correct port -  if you use a 2 port CAN-Card CAN0 is PORT1, CAN1 is PORT2 ?  (sorry but things like that happen!)

- is the wiring OK, did you think of 120 Ohm terminating resistors? (NI Cards come without termination!)

- do you use a NI-CAN Software version compatible with your hardware ?
   We once had problems using a brandnew PCMCIA NI-CAN Card with an outdated  driver software.
   Using old hardware with new software usually works.

 
If you cannot  configure your NI-CAN system to show the frames of your own target-box  in the monitor, I don't  think  writing a LabVIEW application will help.

Good Luck !!
Anke
Message 3 of 5
(5,615 Views)
Thanks Anke/Dirk for the replies.

The largest problem that I had was the baudrate.  It turns out that one of our custom hardware/software was configured to run at 500kbaud but I was told it was running at 250kbaud.  I was able to see some traffic on that particular custom setups.  SO the good news is that I saw some life.

However, on the setup that does count (the one we get credit for), I'm getting some even more strange errors.  I tried connecting the PCAN adapter directly to a port.  I tried connecting both ports on the NI card together.  The results are a crashed driver that requires a reboot in order to work correctly.

That really got me wondering what was up...

After reading your post Anke about the NI cards NOT having the 120Ohm terminators (I knew our hardware had them Dirk and I assumed the NI card did have them), I realized that most likely is the problem.  I'm gonna whip up a quick cable with a terminator on one end and give it a try.  I'll let you guys know what I find out.  Thanks for your help thus far!!

Mike

0 Kudos
Message 4 of 5
(5,582 Views)
Good news guys!!  The terminating resistor was indeed the key.  Thanks for your help!!

Mike
0 Kudos
Message 5 of 5
(5,576 Views)