このコンテンツは設定された言語で表示できません。

このコンテンツは表示可能な別の言語で表示されています。 お使いのブラウザに翻訳機能がある場合はご利用ください。

NI 9853 and 9852 with CompactRIO FAQ

Updated Nov 29, 2022

Reported In

Hardware

  • NI-9853
  • NI-9852

Driver

  • NI-CAN
  • NI-RIO

Issue Details

Frequently Asked Questions about using the 9852 and 9853 modules in a CompactRIO system.

Solution

  1. Do the 9853 and 9852 modules work with CompactRIO?
  2. What format is the data read and written to/from the NI 985x module?
  3. Can I use the 985x modules with the CAN Channel API?
  4. What driver do I need to use the NI 985x with CompactRIO?
  5. Can I use the NI-CAN driver and VIs with NI 985x and CompactRIO?
  6. Do I have to convert my data to and from Frames and Channels?
  7. My NI 9853 CAN1 port is not working, what is going on?
  8. How do the NI 985x timeouts work on the FPGA level? Can I set the timeouts?
  9. Can I test the NI 985x without connecting it to a CAN device?
  10. Is there a good way to test my NI 985x without having an available CAN network?
  11. Can I make my own CAN cable?
  12. Why am I getting a deployment error when I try to run my Real-Time VI on my CompactRIO?
  13. How can I change the baud rate of a port on my NI 985x CompactRIO CAN module from the default of 500 Kbps?
  14. Why does my 985x FPGA IO node have the wrong data type when I specify the particular I/O channel using an FPGA IO Constant?
  15. Can I use my 985x in Scan Mode?


1. Do the 9853 and 9852 modules work with CompactRIO?
    • Yes. 

    2. What format is the data read and written to/from the NI 985x module?
      • The NI 985x FPGA I/O node returns data as either six U32s corresponding to the 192 bits of a CAN Frame, or as a cluster of elements representing the different parts of a CAN Frame such as identifier and timestamp. This can be chosen by right clicking the I/O node and selecting Properties. The same format is used when writing to the I/O node. The cluster format is shown in Figure 1, and the U32 format in Figure 2.

      Figure 1. Front panel of the CAN cluster and block diagram CAN FPGA I/O Node

      Figure 2.U32 representation of the CAN output​
      A library also installs along with the NI-CAN driver that includes VI's that will automatically convert a CAN frame from an array of U32 values to a cluster or vice versa:
      • CAN Convert Frame 1D U32 to NI-CAN NI.vi
      • CAN Convert Frame NI-CAN NI to 1D U32.vi
      Both VI's are located in the labview\examples\nican\logfile.llb library.

      3. Can I use the 985x modules with the CAN Channel API? 
        • The 985x modules do not support the Channel API.  They only support the API shown above.  Therefore, on the FPGA level, the Channel API is not available. However, on the Real Time controller level, you can convert received frames into channels and channels to transmission frames with the Frame Channel Conversion Library. Frames and channels can also be converted with the NI-CAN driver installed on the CompactRIO, but this can be more cumbersome and NI-CAN does not support all cRIO targets. NI-CAN uses CAN virtual ports to convert channels and frames.
         
        4. What driver do I need to use the NI 985x with CompactRIO?
          • The most recent versions of the NI-RIO driver install support for the NI 985x FPGA I/O nodes. However, some old versions of NI-RIO require installation of additional software to support the 985x modules. To determine you need the NI 985x support software, refer to the documentation for the NI-RIO version you intend to use (for example, NI-RIO 1.3.1 requires the addon).

          5. Can I use the NI-CAN driver and VIs with NI 985x and CompactRIO?
            • Yes, depending on your CompactRIO controller model number. The CompactRIO controllers (cRIO 9002, 9004, 9081 and 9082) use the Pharlap or WES7 operating system, which NI-CAN Supports. Once NI-CAN is installed on the development machine, it must also be installed onto the CompactRIO from Measurement & Automation Explorer (MAX). NI-CAN VIs will then be available on the palette when developing your CompactRIO Real Time VI. Subsequent cRIO controllers use the VxWorks or NI Linux Real Time operating systems, neither of which are supported by NI-CAN. However, if you are looking to convert frames to/from channels, this can be done without NI-CAN on a VxWorks controller with the Frame Channel Conversion Library.

            6. Do I have to convert my data to and from Frames and Channels?
              • Not NI-CAN. In fact, all manipulation and processing of the data coming to/from a 985x module on the FPGA level must be done with the Frame API. This is lower level and allows bit by bit manipulation. If your application goal is to do all CAN processing on the FPGA, there is no need or way to use the Channel API. If there are not many different signals on the CAN network you are monitoring or controlling with the NI 985x, the overhead of creating a CAN Channel database and VI may not give the same return on investment as a CAN network with hundreds of signals.
              • However, if communication between an NI-XNET device and an NI-CAN device is necessary, you can pass data to the RT VI and read the data with the XNET Convert VI.

              7. My NI 9853 CAN1 port is not working, what is going on?
                • The CAN1 port on 9853 is designed to be used with a powered CAN bus. This is because the cRIO backplane does not supply enough power to the module for it to be internally powered like the CAN0 port is. You can use CAN1 by either using a powered CAN bus, or attaching an external power supply to the connector. Note: The 9852 requires both ports be powered.

                8. How do the NI 985x timeouts work on the FPGA level? Can I set the timeouts?
                  • There are two timeouts involved. One is the input/output timeout, configured by the user in the 'Advanced' dialog box when right clicking the module and selecting Properties inside the LabVIEW project. Another is a fixed 4 second timeout in LV-FPGA waiting for a response from the CAN module.

                  9. Can I test the NI 985x without connecting it to a CAN device?
                    • No. By design, CAN is not similar to serial where you can write or read from a connector with nothing attached. The NI 985x modules follow the CAN protocol, which means if you attempt to write or read from CAN0 or CAN1 without connecting them to another CAN device, you will experience a timeout. This timeout will occur on writes when you have filled the FPGA side frame buffer of 17 elements. So when you write the 18th frame to the disconnected CAN port, the FPGA side buffer is full and the IO node will time out. This buffer will fill because the module keeps trying to send the first frame out but fails. In CAN, a frame must be acknowledged for it to be successfully transmitted. If it is not successfully transmitted, the CAN controller will try and retransmit or throw an error. This is a feature of the CAN protocol and it used to make it more reliable.

                    10. Is there a good way to test my NI 985x without having an available CAN network?
                      • Yes. Included in the NI Example finder is a loopback test. Inside LabVIEW select Help » Find Examples. Navigate to Hardware Input and Output » CompactRIO » Module Specific IO » CAN » Basic » CAN Basic.lvproj. This project contains a simple FPGA VI that writes out CAN0 and reads in CAN1. Connect CAN0 to CAN1 to run the Loopback test. Bear in mind that CAN1 requires external power (see above).

                      11. Can I make my own CAN cable?
                        • Yes. The NI 9853 manual describes the requirements for a CAN cable on pages 12 and 13. Page 11 describes the required wire connections between CAN devices on a network. Be especially aware of the required impedance of a CAN cable and termination resistors. Some additional resources about proper CAN cable termination are available here, or in the related links section below.

                        12. Why am I getting a deployment error when I try to run my Real-Time VI on my CompactRIO?
                          • You are likely using VIs on your Real-Time VI that have not been installed on the CompactRIO. This can be because you are using the NI-CAN VIs on a CompactRIO that does not have NI-CAN installed (see above). This can also be from using the Frame Channel Conversion Library VIs on a CompactRIO that does not have the Library's driver installed. You can install the driver on the CompactRIO by following the instructions in the corresponding manual.

                          13. How can I change the baud rate of a port on my NI 985x CompactRIO CAN module from the default of 500 Kbps?
                            • To set the baud rate for a NI 985x module from the project complete the following steps:
                            1. Right-click on the module in the Project Explorer window for your project and select Properties. This will open the C Series Module Properties dialog box for the NI 985x module.
                            2. Select the CAN0 or CAN1 tab and select the desired baud rate from the Baud Rate listbox.
                            3. Click OK.
                            • To change the baud rate programmatically:
                            Use a Bit timing FPGA I/O Property Node for the specified CAN port . To use this property, CAN communication must be stopped for the port, otherwise the property node will return an error.  An example implementation is shown below.

                             
                            14. Why does my 985x FPGA IO node have the wrong data type when I specify the particular I/O channel using an FPGA IO Constant?
                              • This is a known issue with 985x IO nodes where, when trying to specify the particular channel of an 985x IO node using an FPGA IO constant, the data type of the IO node incorrectly changes to a U16 typedef instead of allowing the user to select between an array of 6 U32s or a CAN cluster as the node data type. The effect of this problem is that users are unable to use a reentrant subVI to write to the different CAN channels - different subVIs must be used instead. This is a known issue with 985x IO nodes that is being tracked by NI R&D.

                              15.  Can I use a NI-9853 in Scan Mode?
                              • The NI-985x are only supported on FPGA as indicated in C Series Module and CompactDAQ/CompactRIO Hardware Compatibility . But you can use the 985x in FPGA mode and pass the data up to your real time controller using a FIFO. We recomend getting started with the shipping examples available in <Program Files>\National Instruments\<LabVIEW>\examples\CompactRIO\Module Specific\NI 985x