This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ===== CAN ===== <accordion collapsed="true"> <panel title="STKa8Xx"> ==== CAN configuration STKa8Xx ==== DIP switch SW1 and SW2 are used to configure the CAN interfaces CAN1 and CAN2. \\ {{:intern:general_information:tutorial:mba8xx-can.png?400|{{:intern:general_information:tutorial:mba8xx-can.png?400|}} \\ ==== List available CAN Interfaces ==== <code> root@MBaXXX:~ ip link show output: 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: can0: <NOARP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10 link/can 3: can1: <NOARP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10 link/can </code> \\ ==== Activate CAN Interface ==== <code> root@MBaXXX:~ ip link set can0 up root@MBaXXX:~ ip link set can1 up </code> \\ ==== Change Default CAN Bitrate ==== <code> root@MBaXXX:~ ip link set can0 down root@MBaXXX:~ ip link set can1 down root@MBaXXX:~ ip link set can0 type can bitrate <baudrate> root@MBaXXX:~ ip link set can1 type can bitrate <baudrate> </code> \\ ==== Loopback Test CAN Interface ==== * Connect wires to the provided PHOENIX connectors from the Starterkit as shown below.\\ {{:intern:general_information:tutorial:mba8xx-can-loop.png?400|}} \\ * Following command examples shows how to test the CAN interface <code> root@MBaXXX:~ ip link set can0 down root@MBaXXX:~ ip link set can1 down </code> <code> root@MBaXXX:~ ip link set can0 type can bitrate 500000 root@MBaXXX:~ ip link set can1 type can bitrate 500000 </code> <code> root@MBaXXX:~ ip link set can0 up root@MBaXXX:~ ip link set can1 up </code> <code> root@MBaXXX:~ candump can1& root@MBaXXX:~ cansend can0 5A1#11.2233.44556677.88 output: root@tqma8xqp-mba8xx:~# can1 5A1 [8] 11 22 33 44 55 66 77 88 </code> <code> root@MBaXXX:~ killall candump root@MBaXXX:~ candump can0& root@MBaXXX:~ cansend can1 5A1#11.2233.44556677.88 output: root@tqma8xqp-mba8xx:~# can0 5A1 [8] 11 22 33 44 55 66 77 88 </code> </panel> </accordion> <WRAP hide> ==== setting CAN bautrate ==== <code> root@MBaXXX:~ canconfig can<interface nr> bitrate <baudrate> </code> ++++ example | <code> root@MBAXXX:~ canconfig can0 bitrate 500000 </code> ++++ ==== Activate CAN Interface ==== <code> root@MBaXXX:~ ifconfig can<interface nr> up </code> ++++ example | <code> root@MBaXXX:~ ifconfig can0 up </code> ++++ ==== CAN Test CAN0 to CAN1 ==== <code> root@MBaXXX:~ candump can1& root@MBaXXX:~ cansend can0 <byte1> <byte2> </code> ++++ example | <code> root@MBaXXX:~ candump can1& root@MBaXXX:~ cansend can0 0x01 0x10 </code> ++++ </WRAP> Last modified: 2022/08/04 15:02