Can1 not appear on Apalis imx8

Hello,
I have Apalis imx8 board, with Ixora carrier board, and Torizon easy pair last version installed on it.

I need to use Can Bus 0 and Can Bus 1, but I didn’t find any of them.

So, after search, I found that I need to enable them by applying device tree overlay for them.
I did this by adding apalis-imx8_mezzanine_can_overlay.dtbo to the file /sysroot/boot/ostree/torizon-*/dtb/overlays.txt, to be like this:

fdt_overlays=apalis-imx8_hdmi_overlay.dtbo apalis-imx8_spi1_spidev_overlay.dtbo apalis-imx8_spi2_spidev_overlay.dtbo apalis-imx8_mezzanine_can_overlay.dtbo, and then I reboot the board, after reboot I ran the command ip link, and I found the followings:

1: lo: <LOOPBACK,UP,LOWER_UP> 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: sit0@NONE: mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0

3: ethernet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:14:2d:65:e3:e8 brd ff:ff:ff:ff:ff:ff

4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can

5: mlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
link/ether ca:68:eb:13:35:f7 brd ff:ff:ff:ff:ff:ff permaddr c0:e4:34:2f:eb:3b

6: uap0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
link/ether fe:aa:49:7a:17:ba brd ff:ff:ff:ff:ff:ff permaddr c0:e4:34:2f:e9:3b

7: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
link/ether 02:42:5c:0c:04:94 brd ff:ff:ff:ff:ff:ff

8: br-f2d1cf7983ee: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
link/ether 02:42:62:13:59:1a brd ff:ff:ff:ff:ff:ff

with only can0, so where is can1? how can I enable it also please?

Best regards,
Tarek

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello Tarek,

It looks like you’ve successfully enabled can0 but are having trouble with can1 on your Apalis iMX8 with the Ixora carrier board running Torizon.

Here are a few steps to troubleshoot and enable can1:

  1. Check Device Tree Overlay:
    Ensure that the device tree overlay you are using (apalis-imx8_mezzanine_can_overlay.dtbo) actually includes the configuration for both can0 and can1. Sometimes, overlays might only configure one CAN interface. You might need to create or modify an overlay to include both CAN interfaces.

  2. Verify Device Tree Configuration:
    You can check the device tree source to ensure that both CAN interfaces are enabled. Look for entries similar to the following in your device tree source files:

    &can1 {
        status = "okay";
    };
    
    &can2 {
        status = "okay";
    };
    

    Ensure that both can1 and can2 nodes are set to “okay”.

  3. Check Pin Multiplexing:
    Ensure that the pins for can1 are correctly configured in the device tree. The pin multiplexing settings should be correct for the CAN1 interface. For example:

    &iomuxc {
        pinctrl_can1: can1grp {
            fsl,pins = <
                MX8QXP_CAN1_TXD_CAN1_TX 0x40000000
                MX8QXP_CAN1_RXD_CAN1_RX 0x40000000
            >;
        };
    
        pinctrl_can2: can2grp {
            fsl,pins = <
                MX8QXP_CAN2_TXD_CAN2_TX 0x40000000
                MX8QXP_CAN2_RXD_CAN2_RX 0x40000000
            >;
        };
    };
    
  4. Rebuild and Apply the Device Tree:
    After making sure the device tree source is correct, rebuild the device tree blob and apply it to your system. Ensure that the new device tree blob is correctly placed in the /boot directory and referenced in the overlays.txt file.

  5. Check Kernel Modules:
    Ensure that the necessary kernel modules for CAN are loaded. You can check this by running:

    lsmod | grep can
    

    You should see modules like can, can_raw, can_dev, etc.

  6. Check System Logs:
    Check the system logs for any errors related to CAN interfaces. You can use dmesg or journalctl to look for relevant messages:

    dmesg | grep -i can
    journalctl -k | grep -i can
    
  7. Manual Interface Bring-Up:
    Sometimes, manually bringing up the interface can help. Try the following command:

    ip link set can1 up type can bitrate 500000
    

If after these steps can1 still does not appear, there might be an issue with the hardware configuration or a deeper issue in the device tree setup. In such a case, you might want to reach out to Toradex support for more detailed assistance.

Best regards,
[Your Name]

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

Device Tree Overlays Torizon imx7 CAN bus, can0 not found.

Hi,

I checked the contents of the file apalis-imx8_mezzanine_can_overlay.dtbo it was:

/dts-v1/;
// magic: 0xd00dfeed
// totalsize: 0x28d (653)
// off_dt_struct: 0xb8
// off_dt_strings: 0x23c
// off_mem_rsvmap: 0x28
// version: 17
// last_comp_version: 16
// boot_cpuid_phys: 0x0
// size_dt_strings: 0x51
// size_dt_struct: 0x184

/ {
compatible = “toradex,apalis-imx8”, “toradex,apalis-imx8-v1.1”;
fragment@0 {
target = <0xffffffff>;
overlay {
status = “okay”;
};
};
fragment@1 {
target = <0xffffffff>;
overlay {
CAN_SILENT {
gpio-hog;
gpios = <0x00000012 0x00000000>;
line-name = “CAN_SILENT”;
output-low;
};
};
};
fixups {
flexcan3 = “/fragment@0:target:0”;
lsio_gpio2 = “/fragment@1:target:0”;
};
};

So, how to modify this file to include can1 also and enable it please?

Best regards,
Tarek

Hello @tarekmhnds,

As you are using the Ixora Carrier Board, you do not need the apalis-imx8_mezzanine_can_overlay.dtbo. This overlay is intended to be used with the Apalis Development Board and the Apalis iMX8 Mezzanine.

The reason that the CAN interfaces do not show up is that the default device tree which is loaded is the one for the Apalis Evaluation board.
To see both CANs on the Ixora Carrier Board, you need to select the correct device tree for it.

Therefore, please do the following:

  • Remove the apalis-imx8_mezzanine_can_overlay.dtbo overlay from your overlays.txt file.
  • Set the correct device tree for the Ixora Carrier Board:
sudo fw_setenv fdtfile imx8qm-apalis-v1.1-ixora-v1.2.dtb
  • Reboot the board:
sudo reboot now

Now, both CAN interfaces should show up as be usable from the system.

Best Regards,
Bruno

Hello Bruno,

I did these two steps and everything worked as expected.

Now I can see CAN0 and CAN1, and I tested them and they worked fine.

Thanks a lot for your help and support.

Best regards,
Tarek

1 Like

Hello @tarekmhnds,

Thanks for the update.

Best Regards,
Bruno