This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

How to Create CAN FD Dynamic Database in Memory

Updated Jul 10, 2023

Environment

Hardware

  • NI-9862
  • USB-8502
  • PXI-8513
  • PCI-8513
  • PCI-8512
  • PXI-8512
  • NI-9860
  • PXIe-8510
  • PCIe-8510
  • Transceiver Cable

Driver

  • NI-XNET

I am developing CAN FD application that does not have a database file(*.xml, *.dbc). I want to make memory database of CAN FD for frame out stream session. I know that ":memory" is used to make a dynamic database in the memory of VI. But it doesn't work with CAN FD or CAN FD+BRS mode.
How can I make a dynamic database of CAN FD in memory?

To make reference database dynamically, enter :can_fd: or :can_fd_brs: alias to the cluster (:memory) terminal of XNET Create Session node for CAN FD or CAN FD + BRS sessions respectively. For the information about the types of CAN I/O modes, refer to CAN:I/O Mode - NI-XNET Help.

You have to specify the value of 64bit Baud Rate and 64bit FD Baud Rate from XNET Session Property node. 

  • Please click the XNET Session Property node and select Interface » 64bit Baud Rate.  
  • Please click the XNET Session Property node and select Interface » CAN » 64bit FD Baud Rate.


Please refer to the below snippet. This code is based on CAN Frame Output Stream.vi example.

 
Additional Information

If frame error occurs, please check sample point of other ECU or third-party interfaces in your CAN bus refer to this link. Error or Incorrect Frames When Using NI-XNET in CAN FD & BRS

When you use CAN FD or CAN FD + BRS mode, payload length could be as long as 64 bytes. But only below options are available as the payload length.
  • 0 byte
  • 1 byte
  • 2 bytes
  • 3 bytes
  • 4 bytes
  • 5 bytes
  • 6 bytes
  • 7 bytes
  • 8 bytes
  • 12 bytes
  • 16 bytes
  • 20 bytes
  • 24 bytes
  • 32 bytes
  • 48 bytes
  • 64 bytes
For example, if you try to write 9 bytes data, you must choose 12 bytes to write. If you write the data with unsupportable payload length, such as 9 bytes, 11 bytes, etc, the communication doesn't work properly. This problem occurs both the case using a database file and the case using dynamic database. In a dynamic database, you don't have to set any other property for payload length like frame setting in the database file. You can just write that amount data array then implicitly that payload length is used.