CAN bus service

Article content:

General description

The CAN service is designed to manage the CAN network configuration.

CAN network configuration management is possible with the permission "can" or "all" in the profile of the user performing the request.

Management is carried out by the following commands in the "querrytype" field:

getcan - get information about the CAN interface. Extra options are:

  • k - user session ID;
  • if - the name of the CAN interface ("can0" or "can1").

The answer contains information about the status of the module, as well as about the connected and configured devices (if any), and looks like this:

<can if="can1" state="up" mode="normal" timestamp="1981" >
<device node_id="1" vid="781" pcode="VT470
(1)" desc="Motion, vibration, temperature" rev="0.01" sn="217" state="operational" />
</can>

Where, the value of the attributes of the node can are:

  • state - interface state:
    • "up" - the interface is in operation;
    • "down" - the interface is disabled;
  • mode - operating mode:
    • "normal" - the measurement mode;
    • "config" - configuration mode;
  • timestamp - the time of the last update of the information of the bus (format Unix Time Stamp).

The value of the attributes of the device node:

  • node_id - Node ID, node identifier;
  • vid - Vendor ID, the identifier of the manufacturer of the CAN device;
  • pcode - Product Code, CAN device type (digital code);
  • rev - Revision, revision of the CAN device software;
  • sn - Serial Number, serial number of the CAN device;
  • state - the current state of the device;
  • desc - description of the connected device.


deldevicecan - remove the device from the CAN interface configuration. Extra options are:

  • k - user session ID;
  • if - CAN bus name ("can0" or "can1");
  • node_id - node identifier of the CAN interface (1..127).

savecan - save configuration for CAN interface. Extra options are:

  • k - user session ID;
  • if - the name of the CAN interface ("can0" or "can1").

ctlcan - CAN interface control. Extra options are:

  • k - user session ID;
  • if - CAN bus name ("can0" or "can1");
  • mode - the operating mode of the low level daemon. The possible values ​​are:
    • normal - moves the bus into normal operation mode
    • config - puts the bus into configuration mode
    • restart - restart the low-level daemon (when the configuration file is modified).

Configuring devices on the bus

The "ctlcan" command, with the "mode=config" field, puts the corresponding module into the search and configuration mode for the devices connected to the bus. The configuration process takes some time, the more connected devices, the longer it takes to configure them. The module state can be checked by the "getcan" command, using "mode" field in the response, until it returns value "config" to "normal" value. At the same time, if devices were detected, such modules must and will be included as operational, i.e. field "state=up".