TS-7400 V2 CAN: Difference between revisions

From embeddedTS Manuals
(Created page with "The TS-7400 i.MX286 CPU has two FlexCAN ports that use the linux SocketCAN implementation. Please note that the TS-7400_V2 does not have CAN transceivers, these will need to ...")
 
(Clean up comment)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
The TS-7400 i.MX286 CPU has two FlexCAN ports that use the linux SocketCAN implementation.  Please note that the TS-7400_V2 does not have CAN transceivers, these will need to be supplied externally and connected to the CAN pins on the expansion header.  The ports can be set up and used with the following commands:
The TS-7400-V2 i.MX286 CPU has two FlexCAN ports that use the linux SocketCAN implementation.  Please note that the TS-7400-V2 CAN1 port does not have a CAN transceiver, and CAN0 may or may not have one depending on options ordered with the unit.  The ports can be set up and used with the following commands:
<source lang="bash">
<source lang="bash">
devmem 0x80018110 32 0x3ff5f5f
#Note that the following devmem command is only necessary on the October 2, 2013 TS-7670/TS-7400-V2 image.
#Note that this is only necessary on the October 2, 2013 TS-7670 image.
# devmem 0x80018110 32 0x3ff5f5f
modprobe flexcan
modprobe flexcan
ifconfig can0 up
ifconfig can0 up
ifconfig can1 up
ifconfig can1 up
</source><br>
In order to set the baud rate of either CAN interface, the interface must first be brought down with:
<source lang="bash">
ifconfig canX down
</source><br>
Where "X" is interface 0 or 1. At this point, the desired baud rate can be directly entered in to the file "/sys/devices/platform/FlexCAN.X/bitrate", where X is the desired interface.  For example, to set a baud rate of 750kHz on both interfaces:
<source lang="bash">
echo 750000 > /sys/devices/platform/FlexCAN.0/bitrate
echo 750000 > /sys/devices/platform/FlexCAN.1/bitrate
</source><br>
</source><br>


Line 11: Line 22:
<source lang="bash">
<source lang="bash">
candump can0 &
candump can0 &
cansend can1 123#DEADBEEF
cansend can1 can1 7DF#03010C
#This command will return
#This command will return
   can0  123 [4] DE AD BE EF
   can0  7DF [3] 03 01 0C
</source><br>
</source><br>
See the [http://developer.berlios.de/projects/socketcan/ SocketCAN] webpage for more information on utilizing SocketCAN.

Latest revision as of 15:19, 29 October 2021

The TS-7400-V2 i.MX286 CPU has two FlexCAN ports that use the linux SocketCAN implementation. Please note that the TS-7400-V2 CAN1 port does not have a CAN transceiver, and CAN0 may or may not have one depending on options ordered with the unit. The ports can be set up and used with the following commands:

#Note that the following devmem command is only necessary on the October 2, 2013 TS-7670/TS-7400-V2 image.
# devmem 0x80018110 32 0x3ff5f5f
modprobe flexcan
ifconfig can0 up
ifconfig can1 up


In order to set the baud rate of either CAN interface, the interface must first be brought down with:

ifconfig canX down


Where "X" is interface 0 or 1. At this point, the desired baud rate can be directly entered in to the file "/sys/devices/platform/FlexCAN.X/bitrate", where X is the desired interface. For example, to set a baud rate of 750kHz on both interfaces:

echo 750000 > /sys/devices/platform/FlexCAN.0/bitrate
echo 750000 > /sys/devices/platform/FlexCAN.1/bitrate


At this point the ports can be used with standard SocketCAN libraries. In debian we provide cansend and candump to test the ports or as a simple packet send/recv tool. In order to test the two ports together, tie CAN_H of both CAN ports together, and do the same for CAN_L. Then use the following commands:

candump can0 &
cansend can1 can1 7DF#03010C
#This command will return
  can0  7DF  [3] 03 01 0C