Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Read the transmit/receive error counter from CAN

I would like to read every packet that runs accross the CAN bus. I am in a situation where my Can Receive.vi is set to read any CAN bus errors, but I would like to see the entire can packet(including CRC values, DLC values, etc etc). Is there a way to do this? Any sample vi's out there?

Also, I'de like to read the status of the receive/transmit error counter on either side I assume. I am trying to see what my arbitration values hover around (less than 128, over 128, etc etc).

Thanks for any help.
Andre
0 Kudos
Message 1 of 2
(3,538 Views)
Hi Andre

The NI CAN hardware does not have the ability to access the full raw CAN frame. This is because of the used CAN controller (Philips SJA 1000 on Series 2 CAN hardware) does which does not provide all of this information. However, the following data is provided:
  • Arbitration ID (11 or 29 bit)
  • Data Length (DLC)
  • Remote Frame Flag (RTR)
  • Data (0-8 byte)
As you are interested in the raw/unconverted CAN data, you should focus on the NI-CAN Frame API, as the NI-CAN Channel API tries to abstract these information.

With Series 2 CAN hardware, you have read access to the receive/transmit error counter. Take a look at the ncGetAttr function (Frame API) or the GetProperty function (Channel API) and query the ‘Series 2 Error/Arb Capture’ attribute or the ‘Interface Series 2 Error / Arb Capture’ property for that. You can find more details on how to read the returned data in the help for the two functions.

-B2k
0 Kudos
Message 2 of 2
(3,524 Views)