====== CAN ====== ==== STK CAN DIP switches ====\\ ---- ARM architecture ----\\ [[en:arm:tqma28:mba28:dip_switches#can_configuration_s1|STKA28]]\\ [[en:arm:tqma53:mba53:dip_switches#can_configuration_s10|STKA53]]\\ [[en:arm:tqma335x:mba335x:dip_switches#can_configuration_s3|STKA335x]]\\ [[en:arm:tqma6x:mba6x:dip_switches#can_configuration_s13|STKA6x]]\\ [[en:arm:tqma6ulx:mba6ulx:dip_switches|STKA6ULx]]\\ [[en:arm:tqma7x:mba7x:dip_switches#can_configuration_s5|STKA7x]]\\ [[en:arm:tqma57xx:mba57xx:dip_switches#can_configuration_s3|STKA57xx]]\\ [[en:arm:tqma8xx:mba8xx:dip_switches#can_configuration_s7|STKA8Xx]]\\ [[en:arm:tqma8xxs:mb-smarc-2:dip_switches|STKA8XxS]]\\ ---- QorlQ Layerscape ----\\ [[en:layerscape:tqmls102xa:mbls102xa:dip_switches#can_configuration_s2|STKLS102xA]]\\ [[en:layerscape:tqmls1028a:mbls1028a:dip_switches|STKLS1028A]]\\ ==== Setting CAN bautrate ==== root@MBaXXX:~ canconfig can bitrate ++++ example | root@MBAXXX:~ canconfig can0 bitrate 500000 ++++ ==== Activate CAN Interface ==== root@MBaXXX:~ ifconfig can up ++++ example | root@MBaXXX:~ ifconfig can0 up ++++ ==== CAN Test CAN0 to CAN1 ==== root@MBaXXX:~ candump can1& root@MBaXXX:~ cansend can0 ++++ example | root@MBaXXX:~ candump can1& root@MBaXXX:~ cansend can0 0xte 0xst ++++ \\ \\ \\ \\ \\ \\ ++++ STKa8Xx | ==== CAN configuration MBa8Xx ==== DIP switch SW1 and SW2 is 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 ==== root@MBaXXX:~ ip link show output: 1: lo: 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: mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10 link/can 3: can1: mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10 link/can \\ ==== Activate CAN Interface ==== root@MBaXXX:~ ip link set can0 up root@MBaXXX:~ ip link set can1 up \\ ==== Change Default CAN Bitrate ==== root@MBaXXX:~ ip link set can0 down root@MBaXXX:~ ip link set can1 down root@MBaXXX:~ ip link set can0 type can bitrate root@MBaXXX:~ ip link set can1 type can bitrate \\ ==== 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 root@MBaXXX:~ ip link set can0 down root@MBaXXX:~ ip link set can1 down root@MBaXXX:~ ip link set can0 type can bitrate 500000 root@MBaXXX:~ ip link set can1 type can bitrate 500000 root@MBaXXX:~ ip link set can0 up root@MBaXXX:~ ip link set can1 up 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 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 \\ ++++ \\ ++++ STKa6ULx | ==== CAN configuration MBa6ULx ==== DIP switch S3 is used to configure the CAN interfaces CAN1 and CAN2.\\ {{:intern:general_information:tutorial:mba6ulx-can.png?400|}} \\ ==== List available CAN Interfaces ==== root@MBaXXX:~ ip link show output: 1: lo: 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: mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10 link/can 3: can1: mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10 link/can \\ ==== Activate CAN Interface ==== root@MBaXXX:~ ip link set can0 up root@MBaXXX:~ ip link set can1 up \\ ==== Change Default CAN Bitrate ==== root@MBaXXX:~ ip link set can0 down root@MBaXXX:~ ip link set can1 down root@MBaXXX:~ ip link set can0 type can bitrate root@MBaXXX:~ ip link set can1 type can bitrate \\ ==== Loopback Test CAN Interface ==== * Connect wires to the provided PHOENIX connectors from the Starterkit as shown below.\\ {{:intern:general_information:tutorial:mba6ulx-can-loop.png?400|}} \\ * Following command examples shows how to test the CAN interface root@MBaXXX:~ ip link set can0 down root@MBaXXX:~ ip link set can1 down root@MBaXXX:~ ip link set can0 type can bitrate 500000 root@MBaXXX:~ ip link set can1 type can bitrate 500000 root@MBaXXX:~ ip link set can0 up root@MBaXXX:~ ip link set can1 up 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 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 \\ ++++ \\ ++++ STKa6x | ==== CAN configuration MBa6ULx ==== DIP switch S13 is used to configure the CAN interfaces CAN1 and CAN2.\\ {{:intern:general_information:tutorial:mba6x-can.png?400|}} \\ ==== List available CAN Interfaces ==== root@MBaXXX:~ ip link show output: 1: lo: 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: mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10 link/can 3: can1: mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10 link/can \\ ==== Activate CAN Interface ==== root@MBaXXX:~ ip link set can0 up root@MBaXXX:~ ip link set can1 up \\ ==== Change Default CAN Bitrate ==== root@MBaXXX:~ ip link set can0 down root@MBaXXX:~ ip link set can1 down root@MBaXXX:~ ip link set can0 type can bitrate root@MBaXXX:~ ip link set can1 type can bitrate \\ ==== Loopback Test CAN Interface ==== * Connect wires to the provided PHOENIX connectors from the Starterkit as shown below.\\ {{:intern:general_information:tutorial:mba6ulx-can-loop.png?400|}} \\ * Following command examples shows how to test the CAN interface root@MBaXXX:~ ip link set can0 down root@MBaXXX:~ ip link set can1 down root@MBaXXX:~ ip link set can0 type can bitrate 500000 root@MBaXXX:~ ip link set can1 type can bitrate 500000 root@MBaXXX:~ ip link set can0 up root@MBaXXX:~ ip link set can1 up 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 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 \\ ++++