Serial Devices - M100/M200

There are currently three serial devices that MOOS must communicate with. Each communicates through a USB-Serial adapter plugged into one of the onboard computer's USB ports.

Serial devices are assigned a block device node ID at each restart and the same node ID is not always assigned. Therefore, the Linux app udev is used to provide consistent access to devices.
During the booting, uDev scans system events for known parameters. When a device is identified, a symbolic link is assigned that is consistent between reboots.

Serial Device Constant Names
DescriptionModelSerial Port
Vehicle controlKingfisher controller/dev/KINGFISHER
GPSUblox (most models)/dev/UBLOXGPS
GPSGarmin GPS18x-5hz/dev/GARMIN18X5HZ
Digital CompassOS5000/dev/OS5000



uDev Rules File

The OS5000 and the Kingfisher both have built-in USB-Serial adapters. However the GPS uses an external unit. If that unit is changed then the udev rules file will need to be updated.
The rules file must have this path and filename:

    /etc/udev/rules.d/71-MOOS-Serial.rules


Content of the rules file:

 
# udev rules for MOOS on the Kingfisher
#
# These rules seek out the following devices:
#
# Kingfisher M100 control interface
#     Assigns to /dev/KINGFISHER
#
# Ocean Server OS5000 digital compass
#     Assigns to /dev/OS5000
#
# Garmin GPS18X-5HZ or GPS18-5HZ
#     Assigns to /dev/GPS18X5HZ
#
# Ublox GPS (most models)
#     Assigns to /dev/GPSUBLOX

#Ocean Server OS5000 digital compass
KERNEL=="ttyUSB?", ATTRS{manufacturer}=="Silicon Labs", ATTRS{product}=="CP2102 USB to UART Bridge Controller", SYMLINK+="OS5000"

# Garmin GPS18x-5hz gps
KERNEL=="ttyUSB?", ATTRS{manufacturer}=="FTDI", ATTRS{product}=="USB FAST SERIAL ADAPTER", SYMLINK+="GPS18X5HZ"

# Kingfisher control interface
KERNEL=="ttyUSB?", ATTRS{manufacturer}=="Prolific Technology Inc.", ATTRS{product}=="USB-Serial Controller", SYMLINK+="KINGFISHER"

# Ublox
KERNEL=="ttyACM?", ATTRS{manufacturer}=="u-blox AG - www.u-blox.com", SYMLINK+="GPSUBLOX"
 

Note! The above matchings are often looking for strings with unusual spaces, and might not match if you manually write out the lines. If your attribute matching looks right but does not match, use the instructions below to find the right device and copy its relevant strings in. For example, the manufacturer and product attributes (the strings that look like "Silicon Labs" and "CP2102 USB to UART Bridge Controller") of the OS5000 have needed to be copied from the actual device's info from the udevadm info -a -p ... command below.

Some of the FitPC units connect to the Clearpath controller via the FitPC's COM port. In those cases, add these lines to the rules file:

 
# Checks for the COM port built into the FitPC2
KERNEL=="ttyS?", ATTRS{id}=="PNP0501", SYMLINK+="KINGFISHER"
 


Reload uDev rules

    sudo udevadm trigger


Useful link to learn more about uDev:


Finding params to make uDev rules

    $ lsusb

Provides a list of output like this:

    Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 002 Device 003: ID 1e10:2004 Point Grey Research, Inc. Sony 1.3MP 1/3" ICX445 IIDC video camera [Chameleon]
    Bus 002 Device 004: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
    Bus 005 Device 002: ID 1546:01a6 U-Blox AG 
    Bus 007 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
    Bus 007 Device 003: ID 2341:8036  
    Bus 002 Device 007: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

Identify the bus and the device numbers for your USB device of interest. In this example, we are looking foran FTDI device so it's either (confusingly) Bus 002, Device 007 or Bus 007, Device 002.

Now find the path to all the devices using udevadm:

    $ udevadm info -q path -n /dev/bus/usb/002/007
    /devices/pci0000:00/0000:00:1d.7/usb2/2-3/2-3.2
    $ udevadm info -q path -n /dev/bus/usb/007/002
    /devices/pci0000:00/0000:00:1d.2/usb7/7-1

For each result, use udevadm to find details:

    $ udevadm info -a -p /devices/pci0000:00/0000:00:1d.7/usb2/2-3/2-3.2
    Output is long with lots of details
    $ udevadm info -a -p /devices/pci0000:00/0000:00:1d.2/usb7/7-1
    Output is long with lots of details

Now review both outputs to determine the parameters for the device of interest.


Troubleshooting Serial Port Access

In Ubuntu, if the serial device is owned by root with a group of root (rather than a group of dialout), then there may be a simple solution.

First, check that the user is in the dialout group (with the groups command) and add them to the group if they're not in it:

     sudo usermod -a -G dialout student

and then restart to see the changes.

If that doesn't work, there may be another cause. The Ubuntu GUI includes a daemon called modemmanager that takes control of all USB-based serial ports in order to allow celluar modem based connections to interface with the OS.
To turn off modemmanager:

    sudo apt-get purge modemmanager