串行总线

除了:doc:digital <digital-inputs-hardware> 和 :doc:`analog <analog-inputs-hardware>`作为输入,roboRIO还提供了几种与外围设备进行串行通信的方法。

Both the digital and analog inputs are highly limited in the amount of data that can be sent over them. Serial buses allow users to make use of far more-robust and higher-bandwidth communications protocols with sensors that collect large amounts of data, such as inertial measurement units (IMUs) or 2D LIDAR sensors.

支持的串行总线类型

roboRIO支持许多基本类型的串行通信:

此外,roboRIO支持通过CAN总线与外围设备进行通信。但是,FRC | reg | CAN协议非常独特,外围传感器对此的支持相对较少(尽管它广泛用于电机控制器)。

I2C

The I2C port on the roboRIO.I2C roboRIO port pin specifications.

要通过I2C与外围设备通信,每个引脚应连接到设备上相应的引脚。 I2C允许用户将从设备的“链”连接到单个端口,只要这些设备具有单独的ID集即可。

I2C总线也可以通过`MXP expansion port`_使用。 MXP上的I2C总线是独立的。例如,主总线上的设备可以具有与MXP总线上的设备相同的ID。

警告

Be sure to familiarize yourself on the following known issue before using the onboard I2C port: Onboard I2C Causing System Lockups

SPI

Show the SPI port on the roboRIO.SPI roboRIO port pin specifications.

要通过SPI与外围设备通信,每个引脚应连接到设备上相应的引脚。 SPI端口最多支持与四个设备的通信(对应于上图的芯片选择(CS)0-3引脚)。

SPI总线也可以通过 `MXP expansion port`_使用。 MXP端口提供独立的时钟,输入/输出线和一个附加的CS。

RS-232

Location of the RS-232 port on the roboRIO.roboRIO RS-232 port pin specifications.

要通过RS-232与外围设备通信,应将每个引脚连接到设备上相应的引脚。

RS-232总线也可以通过`MXP expansion port`_使用。

The roboRIO RS-232 serial port uses RS-232 signaling levels (+/- 15v). The MXP serial port uses CMOS signaling levels (+/- 3.3v).

备注

By default, the onboard RS-232 port is utilized by the roboRIO’s serial console. In order to use it for an external device, the serial console must be disabled using the Imaging Tool or roboRIO 网络仪表板.

USB Client

roboRIO上的USB端口之一是USB-B或USB客户端端口。可以使用标准USB电缆将其连接到设备,例如Driver Station计算机。

USB主机

Location of the two USB ports on the roboRIO at top center.

roboRIO上的两个USB端口是USB-A或USB主机端口。可以使用例如相机或传感器的标准USB线将它们连接到设备。

MXP扩展端口

Location of the MXP port on the roboRIO directly above the NI logo.MXP pinout.

还可以通过roboRIO的MXP扩展端口使用几种串行总线。该端口允许用户使用许多其他的 digital and :doc:`analog <analog-inputs-hardware>`输入以及各种串行总线。

为了方便起见,许多外围设备都直接连接到MXP端口,不需要用户进行任何接线。

CAN总线

Show the location of the CAN bus terminals in the top left corner of the roboRIO.

此外,roboRIO支持通过CAN总线与外围设备进行通信。但是,由于FRC CAN协议非常特殊,因此很少有外围传感器支持该协议(尽管它广泛用于电机控制器)。使用CAN总线协议的优点之一是可以采用菊花链方式连接设备,如下所示。如果断开链中任何设备的电源,数据信号仍将能够到达链中的所有设备。

A CAN bus topology between motor controllers.

几个CAN主要使用的传感器。一些示例包括:

有关使用与CAN总线连接的设备的更多信息,请参见以下文章:ref:using can devices <docs/software/can-devices/using-can-devices:Using CAN Devices>