Understanding CAN on Colibri iMX6 on Aster

Dear Community,

I have a few questions regarding activating and working with the CAN. I’m using a Colibri iMX6 with an Aster Carrier Board.

  1. On the here you mention how the Colibri, CAN is not a standard pinmux, therefore the kernel and/or device tree needs to be configured and recompiled. Furthermore you talk about having the Flexcan and the MPC251X. What are the differences between these?
  2. I run the command zcat /proc/config.gz | grep CAN and the output was.

    Does this means that I don’t need to configure and recompile the kernel but only need to configured the device tree? If this is so, does the command ec@ec-desktop:~/linux-toradex$ make imx6dl-colibri-aster.dtb does it?
  3. How do I include my device tree into the Toradex Easy Installer?
  4. Since I only plan on working with the Aster carrier board. Can I leave out in the bootfs directory the other carrier board dtb files, having just the zImage and the imx6dl-colibri-aster.dtb?

Thank you very much for clearing up these questions.

Best regards.

HI @cae30989

Thanks for writing to the Toradex Community!

On the here you mention how the Colibri, CAN is not a standard pinmux, therefore the kernel and/or device tree needs to be configured and recompiled. Furthermore you talk about having the Flexcan and the MPC251X. What are the differences between these?

Actually as described only device-tree needs to changed and recompiled and the changes are also described in the mentioned article. The difference between Flexcan and MPC251x is that first CAN controller is is integrated in the SOC and the second one is a separate IC soldered on the carrier board. Aster Carrier does not feature MPC251x (SPI Can).

Does this means that I don’t need to configure and recompile the kernel but only need to configured the device tree? If this is so, does the command ec@ec-desktop:~/linux-toradex$ make imx6dl-colibri-aster.dtb does it? Would then copying the file on the image I wanna use like explained here be sufficient?

No, you don’t to recompile the kernel but the device-tree. Yes, you can copy the aster device-tree to the module.

Please note: Usually the device-tree for the Evaluation Board is used. If you need to change this, then adapt the variable fdt_file in U-Boot Environment too.

Since I only plan on working with the Aster carrier board. Can I leave out in the bootfs directory the other carrier board dtb files, having just the zImage and the imx6dl-colibri-aster.dtb?

Yes, if you change the variable for the device-tree in U-Boot Environment.

In general for the CAN Communication, you would also need a CAN Transceiver which is not featured on Aster Carrier Board but on Evaluation Carrier Board.

Best regards,
Jaski

Hi @jaski.tx ,

thank you for your extended answer. Yes I have a CAN Transceiver on my Aster Carrier Board.

  • I saw that on the link text there must also be some changes done on the imx6qdl-colibri.dtsi Where does this file go?
  • Is there a command that shows me if the can device is there?

Thank you, best regards.

Hi @cae30989

saw that on the link text there must also be some changes done on the imx6qdl-colibri.dtsi Where does this file go?

This file is located here.

Is there a command that shows me if the can device is there?

dmesg | grep -i can

Best regards,
Jaski

Hi @jaski.tx,

Yes, sorry I know where to find the imx6qdl-colibri.dtsi file. My question is, where do I save it after making the corresponding changes.

When I use the command dmesg | grep -i can I get the following output:

[    0.220627] i2c i2c-1: can't use DMA, using PIO instead.
[    0.221383] i2c i2c-2: can't use DMA, using PIO instead.
[    1.337131] vcan: Virtual CAN interface driver
[    1.343516] CAN device driver interface
[    1.349590] 2090000.flexcan supply xceiver not found, using dummy regulator
[    1.359324] flexcan 2090000.flexcan: device registered (reg_base=a09e4000, irq=35)
[    1.370760] imx6dl-pinctrl 20e0000.iomuxc: pin MX6DL_PAD_KEY_ROW4 already requested by 20e0000.iomuxc; cannot claim for 2094000.flexcan
[    1.386739] imx6dl-pinctrl 20e0000.iomuxc: pin-154 (2094000.flexcan) status -22
[    1.397887] imx6dl-pinctrl 20e0000.iomuxc: could not request pin 154 (MX6DL_PAD_KEY_ROW4) from group flexcan2grp  on device 20e0000.iomuxc
[    1.414441] flexcan 2094000.flexcan: Error applying setting, reverse things back
[    1.425989] flexcan: probe of 2094000.flexcan failed with error -22
[    2.164710] caam-snvs 20cc000.caam-snvs: can't get snvs clock
[    2.344434] can: controller area network core (rev 20120528 abi 9)
[    2.359137] can: raw protocol (rev 20120528)
[    2.365319] can: broadcast manager protocol (rev 20161123 t)
[    2.372896] can: netlink gateway (rev 20130117) max_hops=1

I’m probably missing something, since there is no output on the flexcan. You can find the imx6dl-colibri-aster.dts here.

I’m also facing that once I use the imx6dl-colibri-aster.dtb I become permanently the following output without using any commands:

[   56.950529] mxc_sdc_fb fb@0: 640x480 h_sync,r,l: 64,16,80  v_sync,l,u: 4,3,13 pixclock=23750000 Hz
[   57.007206] mxc_sdc_fb fb@0: 640x480 h_sync,r,l: 64,16,80  v_sync,l,u: 4,3,13 pixclock=23750000 Hz
[   57.067838] mxc_sdc_fb fb@0: 640x480 h_sync,r,l: 64,16,80  v_sync,l,u: 4,3,13 pixclock=23750000 Hz
[   57.127227] mxc_sdc_fb fb@0: 640x480 h_sync,r,l: 64,16,80  v_sync,l,u: 4,3,13 pixclock=23750000 Hz
[   57.187717] mxc_sdc_fb fb@0: 640x480 h_sync,r,l: 64,16,80  v_sync,l,u: 4,3,13 pixclock=23750000 Hz
[   66.688416] mxc_sdc_fb fb@0: 640x480 h_sync,r,l: 64,16,80  v_sync,l,u: 4,3,13 pixclock=23750000 Hz

Do you maybe know why this could be happening? You can find the output of dmesg here

Thank you, best regards.

Hi @cae30989

Yes, sorry I know where to find the imx6qdl-colibri.dtsi file. My question is, where do I save it after making the corresponding changes.

You save the changes on your hard-disk. What you need is to compile the device tree and flash to the module.

[ 1.370760] imx6dl-pinctrl 20e0000.iomuxc: pin MX6DL_PAD_KEY_ROW4 already requested by 20e0000.iomuxc; cannot claim for 2094000.flexcan

You have conflicts in your device-tree, you need to correct them. Please have a look at our Developer Article about Device-tree Customization.

I’m also facing that once I use the imx6dl-colibri-aster.dtb I become permanently the following output without using any commands

Which display are you using? What is your settings for vidargs ( fw_printenv vidargs ).

Best regards,
Jaski

Hi @jaski.tx,

I’ll take a look at that, thanks. This is the information I can give you about my display:

 fw_printenv vidargs
    vidargs=video=mxcfb0:dev=lcd,640x480M@60,if=RGB666 video=mxcfb1:off fbmem=8M

Best regards.

Hi @jaski.tx,

I tried compiling the device tree, this is the output. I’m following the instructions with the link you recommended.

ec@ec-desktop:~/linux-toradex$ make imx6dl-colibri-aster-can.dtb
  CHK     scripts/mod/devicetable-offsets.h
  DTC     arch/arm/boot/dts/imx6dl-colibri-aster-can.dtb
Error: arch/arm/boot/dts/imx6qdl-colibri.dtsi:649.30-31 syntax error
FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:317: recipe for target 'arch/arm/boot/dts/imx6dl-colibri-aster-can.dtb' failed
make[1]: *** [arch/arm/boot/dts/imx6dl-colibri-aster-can.dtb] Error 1
arch/arm/Makefile:343: recipe for target 'imx6dl-colibri-aster-can.dtb' failed
make: *** [imx6dl-colibri-aster-can.dtb] Error 2


ec@ec-desktop:~/linux-toradex$ make dtbs
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     scripts/mod/devicetable-offsets.h
  DTC     arch/arm/boot/dts/imx6dl-colibri-aster.dtb
Error: arch/arm/boot/dts/imx6qdl-colibri.dtsi:649.30-31 syntax error
FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:317: recipe for target 'arch/arm/boot/dts/imx6dl-colibri-aster.dtb' failed
make[1]: *** [arch/arm/boot/dts/imx6dl-colibri-aster.dtb] Error 1
arch/arm/Makefile:348: recipe for target 'dtbs' failed
make: *** [dtbs] Error 2

Do you happen to know, why this could be happening?

Thanks, best regards.

HI @cae30989

Error: arch/arm/boot/dts/imx6qdl-colibri.dtsi:649.30-31 syntax error

This is a syntax error which needs to be corrected.

Best regards,
Jaski

Hi @jaski.tx

this is where the mistake shows up.

pinctrl_flexcan1: flexcan1grp {
		fsl,pins = <
			MX6QDL_PAD_GPIO_7__FLEXCAN1_TX		PAD_CTRL_HYS_PU
			MX6QDL_PAD_GPIO_8__FLEXCAN1_RX		PAD_CTRL_HYS_PU
		>;
	};

	pinctrl_flexcan2: flexcan2grp {
		fsl,pins = <
			MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX	PAD_CTRL_HYS_PU
			MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX	PAD_CTRL_HYS_PU
		>;
	};
pinctrl_gpio_2: gpio-2 {
		fsl,pins = <
			//MX6QDL_PAD_GPIO_7__GPIO1_IO07       PAD_CTRL_HYS_PU
			//MX6QDL_PAD_GPIO_8__GPIO1_IO08       PAD_CTRL_HYS_PU
		>;
	};

But this is exactly what I am supposed to use. Or has something changed?

I also noticed that on the imx6qdl-colibri.dtsi file the following is set:

/* Optional on SODIMM 55/63 */
&can1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_flexcan1>;
	status = "disabled";
};

/* Optional on SODIMM 178/188 */
&can2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_flexcan2>;
	status = "disabled";
};

Shouldn’t the status be changed to “okay”?

Best regards.

Hi,

I don’t see an error. Could you share the device-tree changes ( git diff > changes.txt) in a text file?

Shouldn’t the status be changed to “okay”?

This property should be set up to okay in the higher device-tree file ( imx6dl-colibri-eval-v3.dts ).

Best regards,
Jaski

Hello @jaski.tx,

sorry for the late response. The output of the git diff > changes.txt is:

@@ -76,6 +76,14 @@
        status = "okay";
 };
 
+&can1 {
+       status = "okay";
+};
+
+&can2 {
+       status = "okay";
+};
+
 &ecspi4 {
        fsl,spi-num-chipselects = <2>;
        cs-gpios = <
@@ -140,10 +148,9 @@
        pinctrl-0 = <
                &pinctrl_weim_gpio_1 &pinctrl_weim_gpio_2
                &pinctrl_weim_gpio_3 &pinctrl_weim_gpio_4
-               &pinctrl_weim_gpio_5 &pinctrl_weim_gpio_6
+               &pinctrl_weim_gpio_5 
                &pinctrl_csi_gpio_1
                &pinctrl_gpio_1
-               &pinctrl_gpio_2
                &pinctrl_usbh_oc_1 &pinctrl_usbc_id_1
        >;
 
@@ -217,4 +224,3 @@
 &usdhc1 {
        status = "okay";
 };
-

This are the changes in the imx6qdl-colibri.dtsi:

+++ b/home/ec/linux-toradex/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -596,8 +596,8 @@
        };
        pinctrl_gpio_2: gpio-2 {
                fsl,pins = <
-                       MX6QDL_PAD_GPIO_7__GPIO1_IO07       0x1b0b0
-                       MX6QDL_PAD_GPIO_8__GPIO1_IO08       0x1b0b0
+                       //MX6QDL_PAD_GPIO_7__GPIO1_IO07       PAD_CTRL_HYS_PU
+                       //MX6QDL_PAD_GPIO_8__GPIO1_IO08       PAD_CTRL_HYS_PU
                >;
        };
 
@@ -646,15 +646,15 @@
 
        pinctrl_flexcan1: flexcan1grp {
                fsl,pins = <
-                       MX6QDL_PAD_GPIO_7__FLEXCAN1_TX          0x1b0b0
-                       MX6QDL_PAD_GPIO_8__FLEXCAN1_RX          0x1b0b0
+                       MX6QDL_PAD_GPIO_7__FLEXCAN1_TX          PAD_CTRL_HYS_PU
+                       MX6QDL_PAD_GPIO_8__FLEXCAN1_RX          PAD_CTRL_HYS_PU
                >;
        };
 
        pinctrl_flexcan2: flexcan2grp {
                fsl,pins = <
-                       MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX        0x1b0b0
-                       MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX        0x1b0b0
+                       MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX        PAD_CTRL_HYS_PU
+                       MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX        PAD_CTRL_HYS_PU
                >;
        };
 
@@ -1080,4 +1080,3 @@
        };
        };
 };
-

Where can I find the imx6dl-colibri-eval-v3.dts.dts, that corresponds to the aster carrier board to enabled the CAN?

Thanks. Kind regards.

Hi @cae30989

The output of the git diff > changes.txt is:

Which is first file with the changes?

Where can I find the imx6dl-colibri-eval-v3.dts, that corresponds to the aster carrier board to enabled the CAN?

I don’t understand the question. If you want to use the aster carrier board device-tree then you need change the file imx6dl-colibri-aster.dts.

Best regards,
Jaski