Skip to main content

CAN

BoardCAN support in Linux
iMX6 SoloX COMYes
iMX6 Quad COMYes
iMX6 DualLite COMYes
iMX6 UltraLite COMYes
iMX7 Dual (u)COMYes
iMX7ULP uCOMNot supported by CPU
iMX8M Quad COMNot supported by CPU
iMX8M Mini uCOMNot supported by CPU
iMX8M Nano uCOMNot supported by CPU
iMX93 uCOMYes

COM Carrier board Differences

The uCOM Carrier Board V3 has two CAN transceivers available on connectors JP49 (CAN1) and JP50 (CAN2). To use the CAN bus on iMX93, a couple of jumper cables must be used:

CAN BusPinConnectiMX93 Pin Name
1CAN1_TDConnect JP51-2 to JP48-1MX93_PAD_PDM_CLK__CAN1_TX
1CAN1_RDConnect JP51-1 to JP48-2MX93_PAD_PDM_BIT_STREAM0__CAN1_RX
2CAN2_TDConnect JP35-2 to JP48-4MX93_PAD_GPIO_IO25__CAN2_TX
2CAN2_RDConnect JP35-4 to JP48-5MX93_PAD_GPIO_IO27__CAN2_RX

In order to run the example code below, the two CAN busses must also be connected to each other like this:

PinConnect
CAN1_H to CAN2_HConnect JP49-1 to JP50-1
CAN1_L to CAN2_LConnect JP49-2 to JP50-2

This image shows all six connections:

CAN1 and CAN2 connected for iMX93 on uCOM Carrier Board V3

U-Boot

CAN currently not supported.

Linux

Make sure that both can0 and can1 are detected.

ip link show
...
2: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT
group default qlen 10
link/can
3: can1: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT
group default qlen 10
link/can
...

If the text <NOARP,ECHO> appears then the interface is down and must be brought up before it can be used.

ip link set can0 up type can bitrate 125000
ip link set can1 up type can bitrate 125000

As the interfaces are now up, the status will have changed.

ip link show
...
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state
UNKNOWN mode DEFAULT group default qlen 10
link/can
3: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state
UNKNOWN mode DEFAULT group default qlen 10
link/can
...

To test the CAN bus the two interfaces must be connected together as shown above.

The following example listens on can1 and sends on can0. Start by listening on the can1 interface in the background.

candump can1 &

Now send a message on can0 and see what arrives on can1.

cansend can0 5A1#11.2233.44556677.88
can1 5A1 [8] 11 22 33 44 55 66 77 88

The second line above is from the candump process and it shows that it has detected an 8 byte message with id 5A1 being received by the can1 interface.

After completing the tests, terminate the background process with the fg command and Ctrl+C.

fg
candump can1
^C