Gateways

To read or write a live NMEA 2000 bus, canboat needs a CAN interface: a marketed-as-such NMEA 2000 gateway, or a plain CAN adapter. This page lists the ones canboat drives, how to name them, and what each can and cannot do.

Gateways and their options

canboat interface and canboat server take the same gateways and options: canboat interface --kind yachtd tcp://host and canboat server --kind yachtd --device tcp://host. An Actisense gateway also takes the data format it is set to, by Actisense's names (--data-format, default ngt-actisense):

<!-- BEGIN generated by canboat: kinds -->

--kind --data-format Gateways Device Read/write J1939 11-bit
actisensengt-actisenseActisense NGT-1serial (115200), usb, tcp:// (6001)rw––
n2k-asciiActisense W2K-1, PRO-NDC-1E2Ktcp:// (60002), udp://rw––
n2k-actisenseActisense W2K-1, PRO-NDC-1E2Ktcp:// (60002)rw––
raw-asciiActisense W2K-1, PRO-NDC-1E2Ktcp:// (60002), udp://rwyes–
raw-actisenseActisense W2K-1, PRO-NDC-1E2K, NGXtcp:// (60002), serial (115200)rwyes–
mxpgnActisense W2K-2 (CANDIRECT, NMEA 0183)tcp:// (20000), udp://rwyes–
yachtdYacht Devices YDWG-02, YDEN-02, YDNR-02, YDNU-02tcp:// (1457), udp://, serial (38400)rwyes–
miniplexShipModul MiniPlex-3 with NMEA 2000tcp:// (10110), udp://, serial (460800)rwyes–
seasmartChetco SeaSmart, Quark-elec QK-A032/A034/A036, Yacht Devices in NMEA 0183 modetcp:// (10001), udp://, serial (38400)rw––
candumpSensESP N2K gateway, other N2K IP gateways in candumptcp:// (2599)rwyesyes
plainN2K IP gateways in canboat PLAIN/FAST, a canboat server's raw porttcp:// (2599)rw––
ikonvertDigital Yacht iKonvert, NavLink2serial (230400), tcp:// (2000), udp:// (2000)rw––
maretronMaretron IPG100/200tcp:// (6543)rw––
aosAOS NMEA 2000/0183 Simulatorserial (115200), usb, tcp:// (6001)rw––
socketcanLinux SocketCAN interfacecan0rwyesyes
canalystCANalyst-II, Waveshare USB-CAN-Busbrwyesyes
usb-can-aWaveshare USB-CAN-Aserial (2000000)rwyesyes

<!-- END generated by canboat: kinds -->

An option only some gateways have says which in --help, and is refused for the others, as Device refuses the setting in the library:

<!-- BEGIN generated by canboat: options -->

Option Gateways
--baudactisense (ngt-actisense), actisense (raw-actisense), yachtd, miniplex, seasmart, ikonvert, aos, usb-can-a
--bitratesocketcan, canalyst, usb-can-a
--channelcanalyst
--modeactisense (ngt-actisense)
--pcodeactisense (ngt-actisense)
--passwordmaretron
--no-tx-rate-limitikonvert
--ignore-checksumminiplex, seasmart
--nodecandump
node optionscandump, aos, socketcan, canalyst, usb-can-a
--no-claimcandump, aos, socketcan, canalyst, usb-can-a

<!-- END generated by canboat: options -->

These tables, and the gateway help of canboat interface --help and canboat server --help, are written from canboat::bus::Kind, which says what each gateway is and can do.

The Actisense NGT-1 on Linux and macOS

The NGT-1 is an FTDI USB serial device with its own USB ID, 0403:d9aa.

Linux. The standard ftdi_sio driver works once it knows that ID. Adding it after the module has loaded keeps the driver working for your other FTDI devices too:

sudo modprobe ftdi_sio
echo 0403 d9aa | sudo tee /sys/bus/usb-serial/drivers/ftdi_sio/new_id

The device then shows up as /dev/ttyUSB<n> (see dmesg). That number can change between boots; use the stable name under /dev/serial/by-id/, or give it one of your own with a udev rule on its serial number, which udevadm info -q all -n /dev/ttyUSB0 shows:

# /etc/udev/rules.d/99-actisense.rules
SUBSYSTEM=="tty", ACTION=="add", ENV{ID_SERIAL}=="Actisense_NGT-1_1FD34", SYMLINK+="actisense"

Your user needs to be in the dialout group to open it.

macOS. No serial driver binds the NGT-1, so canboat opens it directly over USB: --kind actisense usb, or usb:<serial> with more than one. The C actisense-serial needs a serial device, so on macOS it can't read an NGT-1.

Plain CAN adapters

A plain USB CAN adapter works on every platform: a Linux SocketCAN interface, a CANalyst-II such as the Waveshare USB-CAN-B (04d8:0053), which canboat opens directly over USB — canboat interface --kind canalyst usb or canboat server --kind canalyst --device usb — or a Waveshare USB-CAN-A (1a86:7523) on its serial port, canboat interface --kind usb-can-a /dev/ttyUSB0. On each, canboat is a full NMEA 2000 node: it claims an address and answers ISO Requests.

The CANalyst-II on Windows

canboat opens a CANalyst-II (Waveshare USB-CAN-B) directly over USB, and on Windows that only works when the adapter is bound to Microsoft's WinUSB driver. It does not get WinUSB by itself, and the vendor's software installs its own driver. So:

  1. Run Zadig, select the USB-CAN-B (04D8 0053; use Options → List All Devices if it is not shown), choose WinUSB and click Replace Driver.
  2. canboat interface --kind canalyst usb and canboat server --kind canalyst --device usb then work as on Linux and macOS.

With WinUSB bound, the vendor's own tools (USB-CAN Tool, ControlCAN.dll) no longer see the adapter until its original driver is restored (Device Manager → Roll back driver or Update driver). canboat checks the driver, and says so when it is not WinUSB. This has not yet been tried on real Windows hardware.

The AOS simulator

The Across Ocean Systems NMEA 2000 / NMEA 0183 Simulator also works as a gateway: --kind aos. It speaks the NGT-1's framing but claims no address of its own, so canboat is the node, as on a CANalyst-II: --address and the other node options apply, and --no-claim leaves it sending from its fixed, unclaimed address 75. Each kind refuses the other: --kind aos gives up on a gateway that turns out to be a real NGT-1 (it answers Actisense BEM commands), and --kind actisense on one that says it is the simulator.

Transmit and receive PGN lists (--tx-pgn, --rx-pgn)

Other devices ask a node which PGNs it sends and reads (PGN 126464). --tx-pgn <pgn>[,…] --rx-pgn <pgn>[,…] (on canboat server and canboat interface alike, or Device::pgn_lists in the library) names the PGNs your application sends and reads, so the gateway can answer truthfully. What happens with them depends on the gateway:

<!-- BEGIN generated by canboat: pgn-lists -->

Gateway Receive list (--rx-pgn) Transmit list (--tx-pgn)
actisense (ngt-actisense)ignoredthe gateway's Transmit PGN Enable list: it sends only these
candump (with --node), aos, socketcan, canalyst, usb-can-aadvertised by canboat's nodeadvertised by canboat's node
ikonvertstored in the gateway, which advertises itstored in the gateway, which advertises it and sends only these
The othersignoredignored

<!-- END generated by canboat: pgn-lists -->

canboat's node advertises the lists itself and filters nothing. On an NGT-1, canboat enables the PGNs missing from its Transmit PGN Enable list, which the gateway keeps in EEPROM, and only when one is missing. A gateway that has no such list ignores it, with a warning.

Warning

ON AN iKONVERT OR NGT-1, THE TRANSMIT LIST IS FINAL

Once you name any transmit PGN (--tx-pgn, or pgn_lists.tx), canboat REFUSES TO SEND EVERY PGN THAT IS NOT ON THE LIST. The gateway only transmits the PGNs in its list, and canboat sets that list once, when it starts, so canboat drops the rest up front, logging each refused PGN once, instead of handing the gateway frames it will reject.

Decide the complete list before you start. Only the ISO/NMEA network-management PGNs, and the PGNs of the quirks you enabled (such as wmm's 127258), are allowed without being named. With no transmit PGN named, nothing is refused and the gateway's own list decides.

With no transmit PGN named, canboat still reads an NGT-1's list when it starts, and warns once for each PGN you send that is not on it, which the gateway drops without a word:

WARN ngt1: PGN 127250 is not on the NGT-1's transmit list, which drops it; name it, and every PGN you send, with --tx-pgn (pgn_lists.tx in the library)

A list read in Format 1 (firmware before 2.500) can miss PGNs that are on it; the warning then says the PGN may be dropped. Nothing is warned about before the list is read, about 2 s after the gateway starts, nor on a gateway that does not answer the read, such as the AOS simulator.

An NGT-1 sets the sequence ID (SID) of what it transmits itself: SIDs 0, 1, … written by canboat arrive on the bus as 0x80, 0x81, …

The PGN lists only advertise; they never filter what you receive. To receive only some PGNs, use --rx-filter <pgn>[,…] (or BridgeConfig::rx_filter): an iKonvert filters in the gateway, and for every other gateway canboat drops the rest as they arrive. The network-management PGNs (address claims, requests, product information, …) and canboat's own gateway status always come through.