aboutsummaryrefslogtreecommitdiffstats
path: root/docs/3-Usage.md
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-28 15:15:20 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-04-11 12:41:41 +0200
commit2cf6a1685f3ad53db6714c01d600492fe4bfc11b (patch)
tree80e6e9afd40b8d21120eefda6a58a626bdb33475 /docs/3-Usage.md
parent17f087412b104b8ff96814066b54597ff6082649 (diff)
Improve documentation and added can samples
This explicit use cases with virtual CAN device or Porter board CAN devices Also, it add a complete trip with "vehicle.speed" obd2 signal recurring requests. to be use with canplayer to replay a real car trip. Change-Id: I66c762fa23ed409c812765d6d82e78138edbd455 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'docs/3-Usage.md')
-rw-r--r--docs/3-Usage.md64
1 files changed, 60 insertions, 4 deletions
diff --git a/docs/3-Usage.md b/docs/3-Usage.md
index cc76f1f2..73600a72 100644
--- a/docs/3-Usage.md
+++ b/docs/3-Usage.md
@@ -95,7 +95,7 @@ Once connected, launch `dmesg` command and search which device to use :
[ 1872.809356] usbcore: registered new interface driver usb_8dev
```
-Here device is named **can0**.
+Here device is named `can0`.
This instruction assuming a speed of 500000kbps for your CAN bus, you can try others supported bitrate like 125000, 250000 if 500000 doesn't work:
@@ -112,25 +112,59 @@ This instruction assuming a speed of 500000kbps for your CAN bus, you can try ot
clock 16000000
```
+For a Porter board, you'll have your CAN device as `can1` because `can0` already exists as an embedded device.
+
+The instructions will be the same:
+
+```bash
+# ip link set can1 type can bitrate 500000
+# ip link set can1 up
+# ip link show can1
+ can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN qlen 10
+ link/can
+ can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
+ bitrate 500000 sample-point 0.875
+ tq 125 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
+ sja1000: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
+ clock 16000000
+```
+
## Configure the binding
-Configure the binding specifying in the JSON configuration file the CAN device\(s\) that it will to connect to. Edit file _/var/lib/afm/applications/low-can-binding/0.1/can\_buses.json_ and change the CAN device name to the one you have :
+Configure the binding specifying in the JSON configuration file the CAN device\(s\) that it will to connect to. Edit file _/var/lib/afm/applications/low-can-binding/0.1/can\_buses.json_ and change the CAN device name to the one you will use :
+Using virtual CAN device as described in the previous chapter:
+```json
+{
+ "canbus": "vcan0"
+}
+```
+
+Using real CAN device, this example assume CAN bus traffic will be on can0.
```json
{
"canbus": "can0"
}
```
+On a Porter board there is an embedded CAN device so `can0` already exists.
+
+So you might want to use your USB CAN adapter plugged to the OBD2 connector, in this case use `can1`:
+```json
+{
+ "canbus": "can1"
+}
+```
+
If you have several specify CAN bus devices use an array:
```json
{
- "canbus": [ "vcan0", "can0" ]
+ "canbus": [ "can0", "can1" ]
}
```
-> **WARNING:** Make sure the CAN bus\(es\) you specify in your configuration file match those specified in your generated source file with the [can-config-generator](http://github.com/iotbzh/can-config-generator).
+> **CAUTION VERY IMPORTANT:** Make sure the CAN bus\(es\) you specify in your configuration file match those specified in your generated source file with the [can-config-generator](http://github.com/iotbzh/can-config-generator).
## Run it, test it, use it !
@@ -247,11 +281,33 @@ To watch watch going on a CAN bus use:
# candump can0
```
+Or for an USB CAN adapter connected to porter board:
+
+```bash
+# candump can1
+```
+
Send a custom message:
```bash
# cansend can0 ID#DDDDAAAATTTTAAAA
```
+You can also replay a previously dumped CAN logfiles. These logfiles can be found in _can_samples_ directory under Git repository. Following examples use a real trip from an Auris Toyota car.
+Trace has been recorded from a CAN device `can0` so you have to map it to the correct one you use for your tests.
+Replay on a virtual CAN device `vcan0`:
+```bash
+# canplayer -I trip_test_with_obd2_vehicle_speed_requests vcan0=can0
+```
+
+Replay on a CAN device `can0`:
+```bash
+# canplayer -I trip_test_with_obd2_vehicle_speed_requests can0
+```
+
+Replay on a CAN device `can1` (porter by example):
+```bash
+# canplayer -I trip_test_with_obd2_vehicle_speed_requests can1=can0
+```