VMX-pi provides several different types of Digital Communications Ports:
- Serial Ports
- I2C Port
- SPI Port
The FlexDIO Connectors use JST GH Connectors (see link to purchase cables). JST GH Breakout Boards are also available at the KauaiLabs Store.
This page details how to access these Digital Communication Ports from a WPI Library-based FRC Robot Program.
Serial Ports
The WPI Library “SerialPort” class includes Serial Port identifiers, as follows:
Serial Port Identifier | Type | Notes |
kOnboard | RS-232 Port | Not implemented on VMX-pi |
kMXP | TTL UART | VMX-pi CommDIO “UART” Connector |
kUSB | USB Serial Port | Raspberry Pi “top-left” USB port; aka “kUSB1” |
kUSB1 | USB Serial Port | Raspberry Pi “top-left” USB port |
kUSB2 | USB Serial Port | Raspberry Pi “bottom-left” USB port |
NOTE: As can be seen in the table above, both kUSB and kUSB1 identifiers map to the same physical connector, and thus cannot be used simultaneously on VMX-pi.
The Raspberry Pi Models shown below contain multiple USB Ports which support the USB Serial Port standard; the physical location of each USB Serial Port is shown below:
TTL UART Communication Speeds
Available TTL UART Communication speeds can be as high as 230400 bits/sec. Note that the TTL UART-capable device to which VMX-pi is connected may only communicate at a lower speed than 230400 kbps; consult the external device technical documentation for further details.
USB Serial Port Communication Speeds
USB Serial Port Communication Speeds can be much higher than TTL UART Communication Speeds, and are variable depending upon USB bus usage and the capabilities of the connected device; users do not specify USB Serial Port communication speeds.
I2C Port
VMX-pi provides one I2C port.
The WPI Library “I2C” class includes two (2) I2C Port identifiers, as follows:
I2C Port Identifier | Type | Notes |
kOnboard | I2C Fast Mode* | VMX-pi CommDIO “I2C” Connector |
kMXP | I2C Fast Mode* | VMX-pi CommDIO “I2C” Connector |
*See I2C Communication Speeds section below.
NOTE 1: As can be seen in the table above, both kOnboard and kMXP identifiers map to the same physical connector, and thus cannot be used simultaneously on VMX-pi.
NOTE 2: The Raspberry Pi 4B supports I2C clock-stretching, however previous versions of Raspberry Pi do not. If the I2C device accessed requires I2C clock stretching, Raspberry Pi 4B is required.
I2C Communication Speeds
By default, the Raspberry Pi I2C bus speed is 100Khz (“Standard Mode”). To change the bus speed to 400Khz (Fast Mode) follow these I2C bus speed configuration instructions. Note that the I2C-capable device to which VMX-pi is connected may only communicate at a lower speed than 400Khz; consult the external device technical documentation for further details.
SPI Port
VMX-pi provides one SPI port.
The WPI Library “SPI” class includes five (5) Serial Port identifiers, as follows:
SPI Port Identifier | Type | Notes |
kOnboardCS0 | 4-wire SPI | VMX-pi CommDIO “SPI” Connector |
kOnboardCS1 | 4-wire SPI | VMX-pi CommDIO “SPI” Connector |
kOnboardCS2 | 4-wire SPI | VMX-pi CommDIO “SPI” Connector |
kOnboardCS3 | 4-wire SPI | VMX-pi CommDIO “SPI” Connector |
kMXP | 4-wire SPI | VMX-pi CommDIO “SPI” Connector |
NOTE 1: As can be seen in the table above, each kOnboardx and kMXP identifiers map to the same physical connector, and thus cannot be used simultaneously on VMX-pi.
SPI Communication Speeds
The Raspberry pi supports a wide range of SPI speeds.
By default, the WPI Library SPI class defaults to 500Khz, but this can be increased as necessary.
Although higher speeds are theoretically possible, 16Mhz is considered a safe maximum speed, and lower is recommended due since very fast signals can be easily degraded. Note that the SPI-capable device to which VMX-pi is connected may only communicate at a lower speed than 16Mhz; consult the external device technical documentation for further details.
Note that the actual speed may not match the requested speed; more information on the actual speeds is contained within the Raspberry Pi SPI Documentation.