To use A20 CAN interface you need A20-OLinuXino board and A20-CAN board.
Then you have to install the armbian A20 CAN overlay:
- Download the dts file from:
https://github.com/armbian/sunxi-DT-overlays/blob/master/sun7i-a20/sun7i-a20-can.dts - Backup your SD card where the Linux image for OLinuXino is.
- Copy to the SD card the downloaded file.
- Insert the SD card into you A20-Olinuxino.
- Power on the board and after boot enter following command:
$ sudo armbian-add-overlay <path_to_the_dts_file>
- connect A20-CAN to your OLinuXino and reboot.
You can see if CAN is available now:
$ ifconfig -a can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 NOARP MTU:16 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:10 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:51
To use CAN interface you can install can-utils and setup the CAN interface:
$ sudo apt-get install can-utils $ ip link set can0 down $ ip link set can0 type can bitrate 100000 triple-sampling on loopback off $ ip link set can0 up
Now conect A20-CAN to the CAN network two wire interface.
To send a packet over CAN use :
cansend <can_interface> <packet>
For instance:
$ cansend can0 5AA#10.10.10
To sniff for CAN network messages you can use candump :
$ candump can0
Now you can log your car CAN networking messages and interpret them. There is plenty of info on the web about the different CAN messages which are exchanged on car CAN bus.
Recent Comments