© 2014 Digi International Inc.
6
ConnectCore 6 Linux BSP Reference Manual
Information about programming the CAN socket interface is given in the kernel tree under
Documentation/networking/can.txt
.
Each CAN port appears like a networking interface in the form can
x
where
x
is the port number.
The ports are disabled by default. To configure the CAN, first the bitrate must be set using
ip
tool, for example:
To enable a port execute this command (specifying the appropriate port number):
A sample application called
can_test
is available and can be added to the rootfs by adding “dey-
examples” to the EXTRA_IMAGE_FEATURES of your
local.conf
or by adding “dey-examples-
can” to IMAGE_INSTALL_append. This sample application performs several operations on the
CAN node, like sending and receiving messages. An additional CAN node is needed in the other
end of the bus for the application to work (a CAN analyzer, for example).
For example, to send an 8-bit CAN message to node 'can0' with ID '0x12' and the data pattern
'0x65':
And to receive a similar message:
For more information see the applications help with
can_test --help
.
Ethernet
The ConnectCore 6 supports both Gigabit and 10/100 Ethernet. By default, the Ethernet
interface is configured for Gigabit.
FEC driver Device Tree binding is described at
Documentation/devicetree/bindings/net/fsl-fec.txt
To configure Ethernet for 10/100 you need to do the following change to the Device Tree:
# ip link set can0 type can bitrate 500000
# ifconfig can0 up
# can_test -l 1 -b 8 -d can0 -i 0x12 -p 0x65 -m
# can_test -l 1 -b 8 -d can0 -i 0x12 -p 0x65