Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Basic CAN BUS question

I'm using a CAN BUS for the very first time and would like to have some explanations on something that seems to be a normal behavior. I used the CAN Transmit - event based.vi with NI-Spy to monitor the outputted CAN frame.

 

I've set the baudrate to 1MB, the Arbitration Id to 0x8, the data length to 4 (see attached Front Panel Settings.jpg). When I look at the captured input and buffer I can see that the input data size is 14 and that the buffer contains the arbitration Id 08 followed by four 00 bytes, the data lenght value 04, the four data bytes 01 02 03 04 and then four 00 bytes.

 

Input.jpg Buffer.jpg

 

These results doesn't seems to be compliant with the CAN frame specification (see attachment CAN FRAME Bosch.png). Can somebody explain this to me?

 

 

 

Thanks,

 

Ben

 

 

0 Kudos
Message 1 of 3
(6,911 Views)

Hi Ben,

 

What's the exact hardware you are using with this? Have you checked with the Bus Monitor instead of NI Spy to see if the frames are read correctly. It's generally a lot more difficult to make sense of the frames in NI Spy. You can launch Bus Monitor from MAX by right clicking the specific CAN interface. If you have a 2 port CAN device or have 2 CAN ports that you can access, then you can write out of one and read from the other using the Bus Monitor to make sense of what's being written on the bus.

Raj
National Instruments
Applications Engineer
0 Kudos
Message 2 of 3
(6,897 Views)

Thanks for your answer Raj, I'm using a PCI-8512/2 device. The code use the NI-CAN VIs and I instaleed the compatibility layer with te XNET driver. I had a loopback cable built today and I obtained the expected readings using the Bus Monitor.

 

Thanks again.

 

Ben64

0 Kudos
Message 3 of 3
(6,892 Views)