Overview #
You can configure the CAN-bus integration in V-Link using the file /.config/v-link/can.json
. This JSON file is made up out of 2 parts: interfaces and sensors. They are shown separately below to explain the functions, but in the end these 2 parts are what you fill find when opening can.json
.
Interfaces #
In this part of the json you can configure the 2 CAN channels which are present on the HAT. Usually you dont need to change anything here except your CANBUS uses a different Bitrate.
"interfaces": [
{
"enabled": true,
"bustype": "socketcan",
"channel": "can0",
"bitrate": 500000
},
{
"enabled": false,
"bustype": "socketcan",
"channel": "can1",
"bitrate": 125000
}
],
enabled | Enable/disable the CAN bus interface. If you disable an interface, any associated sensors are not requested/intercepted. |
bustype | Type of the CAN bus. |
channel | The name of the CAN channel, can0, can1, etc. |
bitrate | The speed of the CAN bus. |
In case you are using a different Bitrate, make sure to also edit the two CAN files in this location:
/etc/systemd/network
Keep in mind, the files are only present after you installed V-Link.
Sensors #
Here you can define the engine parameters you want the app to retrieve/intercept from the CAN bus. As mentioned in the introduction, there are two ways to get the value for a given engine parameter. You can either set the sensor to "type": "diagnostic"
or to "type": "internal"
. If you set it to diagnostic. V-Link will send a request to the associated CAN-bus and update the value in V-Link using the response. For internal messages, V-Link only listens on the CAN bus and updates app-values accordingly.
You can add as many sensors as you like by filling in the sensor information using the message format shown at the top of this page.
The configuration file follows a structured JSON format. Below is an example:
"sensors": {
"rpm": {
"interface": "can0",
"enabled": false,
"type": "diagnostic",
"parameter": [
"0x10",
"0x1D"
],
"app_id": "rpm",
"req_id": "0x000FFFFE",
"rep_id": "0x00400021",
"action": "0xA6",
"target": "0x7A",
"is_16bit": false,
"priority": 1,
"scale": "(value * 40)",
"label": "RPM",
"unit": "rpm",
"min_value": 0,
"max_value": 8000,
"limit_start":7000
},
}
interface | The interface on which the messages should be sent/received |
enabled | Enable or disable the sensor |
type | “Diagnostic” or “Stream” |
parameter | The bytes that define which value you want to retrieve from the ECU |
app_id | Unique identifier for V-Link |
req_id | ID of the ECU the value was requested from |
rep_id | ID of the ECU the value will be sent from |
action | Defines the type of message, usually this is only a read command |
target | Target ECU |
is_16bit | Defines if the retrieved value will be an 8-Bit or 16-Bit value |
priority | Defines how often the message should be sent. 1 for high refresh rate, 3 for low refresh rate |
scale | A formula to convert the retrieved value to the correct format |
label | The label inside V-Link |
unit | The unit of the retrieved value |
min_value | The lowest expected value |
max_value | The highest expected value |
limit_start | Defines the limit for the red areas in the gauges |