@csllc/pnix-util
v3.0.4
Published
Utility for Control Solutions Motor Controllers
Downloads
38
Keywords
Readme
pnix-util
This package implements command line and library utilities for managing Control Solutions LLC Phoenix Motor Controllers. See http://controls.com.
Installation
As a Command Line Utility
These utilities are designed to work on Windows, Mac, and Linux computers. You must install the following pre-requisites:
- NodeJS (version 10.22.x or 12.18.x) from https://nodejs.org
- Any drivers required for the interface hardware you intend to use
Install the command line utilities by using the following command in a terminal window:
npm install -g @csllc/pnix-util
Check the version using the command:
npm ls -g @csllc/pnix-util
Update to the latest version:
npm update -g @csllc/pnix-util
After upgrading NodeJS and/or pnix-util
, the utilities may fail to run. This is most likely because the package dependencies also need to be upgraded or rebuilt. This can be done by running:
npm -g -f install
Connection to the Motor Controller
The utility supports different physical connections:
GridConnect CAN-USB-COM
This adapter allows a CANBUS network to be attached to the PC using a USB port. No driver is required for OSX; Windows drivers can be found here: Through Windows 8 Windows 8 RT Driver
PEAK-System PCAN-USB
This adapter allows a CAN Bus network to be attached to a PC using a USB port. The @csllc/cs-pcan-usb
dependency package includes the necessary drivers for Windows and macOS.
Use --connection=can
with -l
to query adapters, and --port=pcan-usb_XX
with the commands below to specify a PCAN-USB adapter, where XX
is the driver-assigned port number.
Kvaser Leaf Light v2
This adapter allows a CAN Bus network to be attached to a PC using a USB port. The @csllc/cs-canlib
dependency package includes the necessary driver for Windows. Under Linux, the kvaser_usb
kernel module must be available to use this adapter with SocketCAN.
Use --connection=can
with -l
to query adapters, and --port=canlib_XX
with the commands below to specify a Kvaser adapter, where XX
is the driver-assigned port number.
Under Linux, Kvaser USB adapters are handled as SocketCAN devices; the PiCAN2 instructions will apply instead.
PiCAN2 for Raspberry Pi
This board adds CAN Bus functionality to a Raspberry Pi through the Linux SocketCAN driver, included in the Raspberry Pi OS.
Use --connection=can
with -l
to query adapters, and --port=socketcan_canXX
with the commands below to specify a Kvaser adapter, where XX
is the operating system-assigned port number.
Configuration
Once the utility and the physical connection is in place, you will need to set up the connection parameters.
Find the name of the interface hardware
Use the -l option to list all available connections:
pnix -l
Identify the port that connects to the controller. If needed, run the command without the hardware adapter attached, then with it attached. The port that appears is the one you want. On Windows, the port is probably named something like 'COM23' though the number may be different.
Find the motor controller(s) on the CANBUS
Now that you know the port name, use the -f option to find the controllers. Note that at least one controller must be powered on, and connected via a properly terminated CANBUS. To find controllers on a 250Kbaud canbus, using port COM23, you would use the command:
pnix -f --port=COM23 --canrate=250000
The utility will output the ID of any controller(s) found on the CANBUS. Often, the controller will be ID 128.
Save the configuration for later use
The configuration can be saved as the default by adding the --save option:
pnix -f --port=COM23 --canrate=250000 --unit=128 --save
pnix-watch
The pnix-watch
command waits for status information from a particular controller and displays it on the screen. Assuming you have a properly connected and configured system, simply use the
pnix-watch
command. You can over-ride configuration using command line switches. For example:
pnix-watch --unit=130
pnix-config
The pnix-config
utility loads a configuration file into the unit. Normally these files will be supplied by Control Solutions - modifying the contents of the file may lead to unexpected results.
pnix-config load setup.txt --shadow
The --shadow option loads the configuration temporarily - it will take effect immediately, allowing you to check that it works as intended. If the controller is power cycled, the changes will be lost.
To make the changes permanent, load the file without the --shadow switch:
pnix-config load setup.txt
After power cycling the controller, the new settings will be in effect.
pnix
The pnix command allows individual configuration items to be changed.
For example,
pnix read sconfig deadband
returns the deadband setting.
pnix write sconfig deadband 0x10
changes the deadband setting to hex 10 (decimal 16)
The above command changes the shadow (active copy) of the configuration. To make the change permanently, use the alternate commands:
pnix write config deadband 0x10