Solution
Modbus I/O servers expects a different resource mapping than the default NI 987x resource mapping. You will need to remap the serial ports to make it work and this is only possible on
NI Linux Real-Time Targets . Using Modbus I/O servers with the NI 987x modules on non-NI Linux Real-Time targets is not supported.
- Enable ssh on your CompactRIO: MAX >> System Settings >> Enable Secure Shell Server (sshd)
- Use an SFTP client such as FileZilla to navigate to /etc/udev/rules.d and rename ni987x.rules to ni987x.rules.bak so that you have a backup file.
- Download the attached ni987x.rules file and transfer it to /etc/udev/rules.d/ using the SFTP client.
- Reboot your CompactRIO and now you will have the first three slots on your cRIO capable to work with Modbus I/O Server. The module in slot one will map from COM 21 to COM 24, where port 1 is COM 21, port 2 is COM 22, etc... The module in slot two will map from COM 25 to COM 28, and slot three will map from COM 29 to COM 32.
Customizing Port Mapping
If you need to change where the modules are located in your cRIO chassis or if you need to change what COM ports each port is mapped to, you can make those changes by altering the
ni987x.rules file. Here is what each part of the rules file does:
For example, if you want to map the first port of the 987x module to COM 20, you will need to change the below entry from
KERNEL=="ttyNIRIOslot1port0", SYMLINK="ttyS20", GROUP="tty", MODE="666"
to
KERNEL=="ttyNIRIOslot1port0", SYMLINK="ttyS19", GROUP="tty", MODE="666"
Single 987x Module
If you are only using a single 987x module and need to be able to move it around in different slots without changing the rules file, you can do so by changing the rules entry so that the only line in there besides the first line is:
KERNEL=="ttyNIRIOslot[0-9]*", SYMLINK="ttyS1%n", GROUP="tty", MODE="666"
Note that the mapped ports for the single NI-987x will start at COM 11 and go to COM 14. This mapping should not change regardless of which slot the module is placed in, as long as the cRIO only has a single NI-987x module in it.