From Tizen Wiki
Jump to: navigation, search

This guide was derived from the docs in the kernel can driver

How to get the PEAK CAN-USB working on tizen:

 $ zypper in iproute2

[plug in device]

 $ ip link
 can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT qlen 10 link/can

So right away we can see it recognizes the device. Now set bit-timing:

 $ ip link set can0 type can tq 125 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1

Alternatively you can have the kernel auto calculate the bit-timing by just setting the bitrate:

 $ ip link set can0 type can bitrate 125000

Brink up the device:

 $ ip link set can0 up type can

lights start blinking on the device. Yay!

Now to test.

I downloaded can-utils from git and compiled:

Then I connected two peak can USB devices to the machine and brought them both up (can0 and can1). I connected the two can devices together using a male-to-male adapter.

 $ ./candump can1

<from another terminal>

 $ ./cansend can0 5A1#
 $ ./candump can1
 can1  5A1   [8]  11 22 33 44 55 66 77 88

message sent.

Now you should be able to write code that uses socketcan to interface with the device.