Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Having trouble transmitting to CANbus using LabView

Hello,

I am trying to transmit a simple packet to the CANBus using a LabView program I have written. When I use MAX to view what packets have been received, it will receive maybe ten packets of data, then it will not show any more as being sent. I will get a warning message BFF6206B(CanWarnCommNoAck), but I do not know what the problem is. I am using an internally powered cable to connect my PCMCIA card on my laptop to the PCI connection on my desktop. I have tried running the txperiodic.vi file I found on the website, and it will send the first few packets fine, but then will transmit 5 or 6 packets at a time, then MAX will stop receiving packets. When I stop the txperiodic.vi, I will get the error "1074388885 occurred at NI-CAN Close Object (ncClose.vi)". Can anyone suggest what I am doing wrong?

Thank you,
Brian
0 Kudos
Message 1 of 9
(6,366 Views)
Hello Brian,

when you say you use MAX to receive the CAN Frames, I assume you use the BusMonitor or the TestPanel utility? If so, make sure that the 'Listen Only' checkbox of those utilities is not checked. Also make sure that those utilities use the same baud rate as your VI. The utilities use the baud rate the a particular CAN port is configured to (right-click on a CAN port in MAX and select Properites).

-B2k
0 Kudos
Message 2 of 9
(6,361 Views)
B2k,

I am using the same baud rate, 125K, and the bus monitor is not in listen only mode, but it will not recieve packets after a certain ammount are sent, then when I stop the transmission vi I receive the error message BFF6206B.

Brian
0 Kudos
Message 3 of 9
(6,351 Views)
Hello Brian

Your VI looks fine. I have no trouble running it 'against' the BusMonitor running @125k. Could you post an NI Spy logfile from running the application on your laptop? NI Spy captures calls from your VI to the NI-CAN driver. Launch NI Spy at:
Start » Programs » National Instruments » NI Spy

What version of NI-CAN are you using (NI Spy only gets installed with NI-CAN 2.0 or higher)?

-B2k
0 Kudos
Message 4 of 9
(6,343 Views)
B2k,

I am using NI-CAN version 2.2 and the logfile looks like this:
1. ncConfig ("CAN0", 8, {0x80000006,0x80000007,...}, {0x00000001,0x0001E848,...})
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:09.037 Call Duration: 00:00:02.163
Status: 0 (VI_SUCCESS)
2. ncOpenObject ("CAN0", 108790040)
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:11.200 Call Duration: 00:00:00.020
Status: 0 (VI_SUCCESS)
3. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:11.220 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
4. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:11.951 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
5. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:12.822 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
6. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:13.794 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
7. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:14.755 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
8. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:15.786 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
9. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:16.788 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
10. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:17.769 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
11. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:18.751 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
12. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:20.023 Call Duration: 00:00:00.000
Status: 0x3FF6206B
13. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:21.234 Call Duration: 00:00:00.030
Status: 0x3FF6206B
14. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:22.015 Call Duration: 00:00:00.030
Status: 0x3FF6206B
15. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:22.887 Call Duration: 00:00:00.030
Status: 0x3FF6206B
16. ncWrite (108790040, 14, "..............")
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:23.778 Call Duration: 00:00:00.030
Status: 0x3FF6206B
> 17. ncWrite (108790040, 14, "..............")
> Process ID: 0x000000FC Thread ID: 0x00000870
> Start Time: 09:31:24.789 Call Duration: 00:00:00.000
> Status: 0xBFF6206B
18. ncCloseObject (108790040)
Process ID: 0x000000FC Thread ID: 0x00000870
Start Time: 09:31:31.269 Call Duration: 00:00:00.030
Status: 0 (VI_SUCCESS)



Brian
0 Kudos
Message 5 of 9
(6,335 Views)
Hi Brian and b2k,

I'm always a big fan of ensuring that the basics are covered, so I just want to ensure that we are using a cable that meets the CAN specification and that the ends are properly terminated. I can't see anything that jumps out at my from the Spy capture as a warning flag, what about you, b2k?

john m
Applicatons Engineer
0 Kudos
Message 6 of 9
(6,330 Views)
John M,

Thank you. The simple things in life are oft overlooked. I had been using a serial cable as an extension so the cord would reach from my lappy to the desktop. I guess that this is not an appropriate cable to use. I had assumed that it was because my colleagues have been using it to test the board since before I started working here. Once I made a direct connection, my code worked like a charm. Thank you B2k and John for all of your help.

Brian
0 Kudos
Message 7 of 9
(6,324 Views)
You're welcome, Brian. I've made the same mistake before... it seems like any 9 pin cable should work. If only life were so simple. Glad we could help out!

john
0 Kudos
Message 8 of 9
(6,319 Views)
I have a could of huge honking devices I am controlling with CAN, I need to run cables to them, something like 25 feet would be nice. Is this possible. they have cables hanging out of the back of the device, so it would be nice if I could get some sort of CAN extension cable. Is this at all possible. I am looking all over the NI site and cannot find something like this. Does it exist?
0 Kudos
Message 9 of 9
(4,886 Views)