CAN interface not working on Colibri imx8qxp + IRIS carrier board

Hi,
I added overlay to imx8qxp-colibri-eval-v3.dts , I can see all 3 interfaces can0, can1 and can2, can1 is using the internal CAN controller on the module.
However, when send data to can1:

cansend can1 123#DEADBEEF

ip -details -statistics link show can1

4: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
can1 always has ERROR-ACTIVE, and TX sends 0 bytes.
Any idea?

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*

  • Copyright 2019 Toradex
    */

/dts-v1/;

#include “imx8qxp-colibri.dtsi”
#include “imx8x-colibri-eval-v3.dtsi”

/ {
model = “Toradex Colibri iMX8QXP on Colibri Evaluation Board V3”;
compatible = “toradex,colibri-imx8x-eval-v3”,
“toradex,colibri-imx8x”, “fsl,imx8qxp”;
aliases {
can0 = &flexcan1;
can1 = &flexcan2;
can2 = &flexcan3;
};
};

&lpuart0 {
status = “disabled”; // Disable conflicting UART
};

&lpuart1 {
status = “disabled”; // Disable conflicting UART
};

&lpuart3 {
status = “disabled”; // Disable conflicting UART
};

&flexcan1 {
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_flexcan1>;
status = “okay”;
};

&flexcan2 {
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_flexcan2>;
status = “okay”;
};

&flexcan3 {
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_flexcan3>;
status = “okay”;
};

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

When encountering an issue where the CAN interface is not working as expected on the Colibri iMX8X with the Iris carrier board, and specifically, the can1 interface shows ERROR-ACTIVE state with no data transmission, there are several steps and considerations to troubleshoot and potentially resolve the issue:

  1. Check Physical Connections: Ensure that all physical connections, including CAN transceivers and termination resistors, are correctly set up. The Iris carrier board requires proper setup for CAN communication, including the correct placement of jumpers and connections to the CAN transceiver.

  2. Verify Bit Timing Configuration: The ERROR-ACTIVE state indicates that the CAN controller is active but has detected errors. This can sometimes be due to incorrect bit timing configurations. Ensure that the bit rate and timing parameters are correctly configured for your CAN network.

  3. Ensure Proper CAN Termination: CAN networks require termination resistors at both ends of the CAN bus to prevent signal reflections. Lack of proper termination can lead to communication errors.

  4. Review Device Tree Configuration: From the device tree snippet provided, it appears the configuration for flexcan2 (which is aliased as can1) is enabled. Ensure that the pin multiplexing (pinctrl-0) is correctly defined for &flexcan2 and matches the physical connections on the Iris carrier board. Incorrect pin configurations can prevent the CAN interface from functioning correctly.

  5. Disable Unused Interfaces: You’ve correctly disabled conflicting UARTs (lpuart0, lpuart1, and lpuart3). Ensure no other peripherals that share pins with the CAN interfaces are enabled, as this could cause conflicts.

  6. Check for Software Updates: Ensure that your TorizonCore and the Linux kernel are up to date. Sometimes, issues with peripherals like CAN are resolved in newer software releases.

  7. Testing with a Known Configuration: If possible, test the CAN interface with a known working configuration or on another board to rule out hardware issues.

  8. Use iproute2 Tools for Diagnostics: Utilize tools like candump to monitor CAN traffic and verify if the issue is with sending, receiving, or both. The ip -details -statistics link show can1 command is useful, but additional diagnostic information can be gleaned from actively monitoring the bus.

  9. Review Kernel Logs: Check the kernel log (dmesg) for any errors or warnings related to

Please, also check if these links can help you solve your problem:

CAN (Linux) | Toradex Developer Center.

Can you provide more details about this step, and where is the jump on IRIS board?

Check Physical Connections: Ensure that all physical connections, including CAN transceivers and termination resistors, are correctly set up. The Iris carrier board requires proper setup for CAN communication, including the correct placement of jumpers and connections to the CAN transceiver.
[/quote]

I guess CAN RX pin on CPU side for some reason stays low, which is dominant, so CAN controller can’t initiate transfer until bus is passive and idle. So you keep observing ACTIVE and no TX. It could be due to some shortcut, improper pinmuxing, etc etc.


Thank you Edward,
From this IRIS carrier schematic, I can’t find where the SODIMM 63 and 55 are connected, those two signals. Anywhere I can probe the signals?
Thanks a lot!

What is your pinmuxing for FlexCAN pins?
How did you connected CAN transceivers to the IRIS board?

pinmuxing for FlexCAN pins:
&iomuxc {
/* Colibri optional CAN on UART_B RTS/CTS /
pinctrl_flexcan1: flexcan0grp {
fsl,pins = <IMX8QXP_FLEXCAN0_TX_ADMA_FLEXCAN0_TX 0x21>, /
SODIMM 32 /
<IMX8QXP_FLEXCAN0_RX_ADMA_FLEXCAN0_RX 0x21>; /
SODIMM 34 */
};

    /* Colibri optional CAN on PS2 */
    pinctrl_flexcan2: flexcan1grp {
            fsl,pins = <IMX8QXP_FLEXCAN1_TX_ADMA_FLEXCAN1_TX                0x21>,          /* SODIMM  55 */
                       <IMX8QXP_FLEXCAN1_RX_ADMA_FLEXCAN1_RX                0x21>;          /* SODIMM  63 */
    };

    /* Colibri optional CAN on UART_A TXD/RXD */
    pinctrl_flexcan3: flexcan2grp {
            fsl,pins = <IMX8QXP_FLEXCAN2_TX_ADMA_FLEXCAN2_TX                0x21>,          /* SODIMM  35 */
                       <IMX8QXP_FLEXCAN2_RX_ADMA_FLEXCAN2_RX                0x21>;          /* SODIMM  33 */
    };

};

CAN transceivers:
Does Colibri imx8x module has transceivers? the connection between Colibri imx8x with IRIS is by SODIMM connector. I don’t have any extra hardware wiring.

Do I have to wire my own transceiver? Where is the CAN1_H and CAN1_L on iris board so I can probe the signal?

From chatgpt, looks like there is a transceiver on IRIS, but from the schematic I can’t find it, and can’t find the jumper jp4 either.

CAN Transceiver on IRIS Carrier Board

The IRIS carrier board includes CAN transceivers that interface with the CAN controller signals provided by the Colibri module. These transceivers are necessary for converting the logic-level signals from the Colibri module to the differential signals used on the CAN bus.

Routing of CAN Signals

  • SODIMM Pin 55: Typically used for CAN_L
  • SODIMM Pin 63: Typically used for CAN_H

On the IRIS carrier board, these pins are routed to the onboard CAN transceivers. From there, the transceiver’s differential output (CAN_H and CAN_L) is connected to the DB9 connectors on the carrier board, allowing you to connect to a CAN bus.

Example: How Pins are Routed

  1. Colibri Module CAN Pins:
  • Pin 55 (CAN_L) and Pin 63 (CAN_H) on the Colibri module are connected to the corresponding CAN transceiver inputs on the IRIS carrier board.
  1. CAN Transceiver Outputs:
  • The CAN transceiver on the IRIS board then converts these signals to the appropriate levels for CAN bus communication.
  1. DB9 Connector:
  • The transceiver outputs are routed to the DB9 connectors on the IRIS carrier board, which are used for connecting to the CAN bus.

Verifying CAN Configuration

To verify the CAN configuration, ensure the following steps:

  1. Physical Connection:
  • Verify that the Colibri module is securely connected to the IRIS carrier board through the SODIMM connector.
  1. Jumper Settings:
  • Ensure that the jumpers on the IRIS carrier board are correctly set to enable power to the CAN transceivers (e.g., JP4).
  1. Device Tree Configuration:
  • Make sure the device tree on your Colibri iMX8X module is configured correctly to enable the CAN interfaces.

Is there a gpio pin from Colibri imx8x to power the transceiver on IRIS board?

The Iris board has no CAN transceivers. While the Colibri iMX8X module has FlexCAN controllers, you must use CAN transceivers to convert TTL signal levels to the CAN bus physical layer specifications. Direct connection of Colibri pins to the CAN bus signals may damage the module.

Hi Alex,

I don’t have a transceiver at hand, and I just want to verify that the device tree and device driver are working. My reasoning is that even without a transceiver, when sending a message with the command:

cansend can1 123#DEADBEEF

The TX buffer should be dumped out to the CAN bus.

However, when checking the status of CAN1 with the command:

ip -details -statistics link show can1

I see the following output:

can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0

CAN1 is in the state “ERROR-ACTIVE”, and TX sends 0 bytes.

Does the FlexCAN controller on the Colibri iMX8X require a transceiver? (Edward suggested that the FlexCAN controller detects the CAN bus in the dominant state).

Is there any way for me to verify that the CAN interface is working with my hardware setup: Colibri iMX8X + IRIS?

Thanks!

The CAN bus protocol requires each CAN bus node to read back its own transmitted frame data to verify if the transmission was successful. Therefore, the best way to test the FlexCAN controller is by using a CAN transceiver and a properly terminated CAN bus line. Alternatively, you can connect the RX and TX lines together.

Please note that according to the pin muxing you selected:

  • IMX8QXP_FLEXCAN1_TX_ADMA_FLEXCAN1_TX is available on SODIMM_55
  • IMX8QXP_FLEXCAN1_RX_ADMA_FLEXCAN1_RX is available on SODIMM_63

However, neither SODIMM_55 nor SODIMM_63 are connected to the Iris extension connector. I suggest using the Colibri Evaluation Board instead of the Iris for your testing and prototyping. Alternatively, you can change the FlexCAN pin muxing to:

  • IMX8QXP_UART2_RX_ADMA_FLEXCAN1_RX
  • IMX8QXP_UART2_TX_ADMA_FLEXCAN1_TX

This will make the CAN signals available on SODIMM_19 and SODIMM_21, respectively and that signals are routed to the Iris extension connector.
Please check Colibri IMX8X datasheet and Iris board schematic for details.

My device tree file:
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*

  • Copyright 2019 Toradex
    */

/dts-v1/;

#include “imx8qxp-colibri.dtsi”
#include “imx8x-colibri-eval-v3.dtsi”

/ {
model = “Toradex Colibri iMX8QXP on Colibri Evaluation Board V3”;
compatible = “toradex,colibri-imx8x-eval-v3”,
“toradex,colibri-imx8x”, “fsl,imx8qxp”;
aliases {
can0 = &flexcan1;
};
};
&lpuart0 {
status = “disabled”; // Disable conflicting UART
};

&lpuart1 {
status = “disabled”; // Disable conflicting UART
};

&lpuart3 {
status = “disabled”; // Disable conflicting UART
};

&flexcan1 {
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_flexcan1>;
status = “okay”;
};
&iomuxc {

    pinctrl_flexcan2: flexcan1grp {
            fsl,pins = <IMX8QXP_UART2_TX_ADMA_FLEXCAN1_TX                0x21>,          /* SODIMM  19 */
                       <IMX8QXP_UART2_RX_ADMA_FLEXCAN1_RX                0x21>;          /* SODIMM  21 */
    };

};

After load and reboot,
ip link set can0 up type can bitrate 500000
ip -details -statistics link show can0
3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 500000 sample-point 0.875
tq 25 prop-seg 37 phase-seg1 32 phase-seg2 10 sjw 1 brp 1
flexcan: tseg1 2…96 tseg2 2…32 sjw 1…16 brp 1…1024 brp_inc 1
flexcan: dtseg1 2…39 dtseg2 2…8 dsjw 1…4 dbrp 1…1024 dbrp_inc 1
clock 40000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 parentbus platform parentdev 5a8d0000.can
RX: bytes packets errors dropped missed mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0

Do I still need a CAN transceiver connected to SODIMM_19 and SODIMM_21?
Any way I can send out TX buffer and error free on the CAN bus?
which pins are SODIMM_19 and SODIMM_21 on the IRIS extension connector?
Thanks a lot.

image

So the “ERROR-ACTIVE” state is caused by “no CAN transceiver”? But I measure UART_C RXD and TXD, both are 3.29V, the bus state should be in IDLE state.

Thank you very much for your information.

For my hardware configuration Colibri imx8x + iris carrier board, with my device tree I can bring up all 3 CAN interfaces, they are all in the state “ERROE ACTIVE” initially which is normal. Since I don’t have transceiver, once I send a message, the state turns to “BUS OFF” as expected.

I tried to route the signal to SODIMM PIN 19 and 21 which are connected to iris extension connector pin 34 and 35 by
IMX8QXP_UART2_TX_ADMA_FLEXCAN1_TX 0x21
IMX8QXP_UART2_RX_ADMA_FLEXCAN1_RX 0x21

There are some differences: I can run “cansend can1 123#DEADBEEF” a few times, then check the bus state, it is still in “ERROR ACTIVE”, unlike before the state was changed to “BUS OFF” after sending one packet.

Connect the pins RX and TX(Pin 34 and 35) makes no difference.

Anyway, the main reason is still my hardware lack of transceiver.

Hi Alex,
I saw the signal on Pin 34 and 35 from extension connector on iris when sending a message. Thanks a lot!

You’re welcome! I’m glad I could help.