
To establish a connection using the CAN interface, connect your system as shown below using the default parameter.
Please note:
The Avisaro "Box" and "Cube" products come with a preinstalled application script. Thus, the CAN interface is used to either log data or forward data over a wireless connection. In order to use the CAN interface to type in configuration settings, the script execution must be switched off. See here for details.
The Avisaro "Module" are shipped with no preinstalled script.
Typically, the CAN interface is not well suited to send configuration data - although this can be done. Use SD-memory card or the web interface instead for easy configuration.
The are two CAN interfaces which can be used on an individual basis. CAN interface 'Port 1' is the primary one, 'Port 2' is the auxiliary one. The primary port can be used to transmit commands to configure the Avisaro product. Both ports can be used to receive CAN messages to be stored or to be forwarded wirelessly over a network.
The CAN port 1 is designed to receive user data as well as commands adressed to configure the Avisaro product.
For all Avisaro CAN Data Logger and Avisaro CAN WLAN products, the CAN interface is already activated and operates with default values. Change baudrate and filter settings using the web interface (
more) or a configuration file on a SD memory card (
more). The "autorun.txt" configuration file should contain:
prot can
can 125000 49 0 49 0
can errlog off
If a Avisaro Module product was purchased or after a 'reset to factory settings' command, the CAN interface must be activated and configured (
more).
The second CAN interface can only be used within Scripting (
more).
Baudrate: 125 kbits/s
CAN ID send: 49 (hex)
CAN ID receive: 49 (hex)
Functions such as CAN frame logging, CAN sniffing and CAN frames over wireless connection are realized using the Scripting capability of the Avisaro devices.
Within Scripting, CAN messages can be fetched and send over both CAN interfaces. There is a seperate documentation on how to use the CAN interfaces within Scripting (
more).
Please notice: The configuration of the CAN interface 1 and interface 2 is different. Interface 1 is configured as described above. Interface 2 is configured only within Scripting.
The Command Interface is available on the primary CAN interface. To send commands, an active Script must be disabled (usually, a Script fetches all incoming data and either logs it into a file or forwards it over WLAN). Thus, if the Avisaro Device is working as a Logger or Device Server, the command interface is not active. See
here on how to disable a Script.
To send a command, they are packaged into the payload of the CAN frames. Those CAN frames are send to device ID 0x49 (default setting). The Avisaro device sends the answer back out on ID 0x49 - with the answer packaged into the payload.
Example: The command "ip local 192.168.0.90" is split into CAN messages:
1) ID: 0x49, Length: 8, Bytes: 0x69 0x70 0x20 0x6C 0x6F 0x63 0x61 0x6C // for: ip local
2) ID: 0x49, Length: 8, Bytes: 0x20 0x31 0x39 0x32 0x2E 0x31 0x36 0x38 // for: 192.186
3) ID: 0x49, Length: 7, Bytes: 0x2E 0x30 0x2E 0x39 0x30 0x0D 0x0A // for .0.90 cr lf
Answer: (">")
1) ID: 0x49, Length: 3, Bytes: 0x0D 0x0A 3E // ">" cr lf
CAN messages are stored internally in a fixed 28 Byte long format - no matter how long the original CAN messages was. This message format is documented
here. All operations with CAN messages are based on this 28 Byte format: To receive a message within Scripting, a 28 Byte array must be declared; sending CAN messages over TCP is done in 28 Bytes (or multiple of it) chunks.
For diagnostic applications, it is useful to get information about invalid CAN frames. Those are usually discarded. Using "CAN ERRLOG" command (via 'autorun.txt' configuration file or command interface), the reception of mal-formatted CAN frames can be activated.
With this option activated, error frames are stored with a specific ID and the error message coded into the payload. Refer to the "CAN ERRLOG" documentation how the different error states are coded.
Avisaro implemented a proprietary flow control mechanism, which is similar to the one used on the RS232 interface. Purpose is to avoid data loss due to buffer overflow. A typical scenario would be if CAN messages are forwarded using a slow wireless network. In this case, some CAN messages are buffered by the Avisaro device. If network remains slow and CAN load high, those bufferes may overflow. The CAN flow control mechanism can tell other CAN devices that buffers run low.
When enabled, the Avisaro device sends a CAN frame with a single Byte 0x19 in the payload. This is similiar to the "XOFF" Byte on a RS232 connection. When buffers are available again, a message with 0x17 is send. This is similar to the "XON" on RS232. The CAN ID used for those messages is configurable, default is CAN ID 0x49.
Command Interface
(CAN Configuration): command to configure baudrate, error frames, flow control
Scripting
(CAN): Using CAN in Scripting
Website
(DI: CAN): Website configuration
General
(CAN): Internal frame format