Unable to parse input tree - CAN

Dear Community,

I’m working to get the CAN enabled on my Colibri iMX6DL using an Aster carrier board. I did the following:

  1. Got the Linux Kernel with git clone -b toradex.x_4.14_2.0.x-imx git://git.toradex.com/linux-toradex.git

  2. Got the toolchain gcc-arm-8.2-2019.01-x86_64-arm-linux-genueabihf.tar.xz

  3. Set the environment variables ARCH=arm and CROSS_COMPILE=arm-linux-gnueabihf-

  4. Set the default configuration make colibri_imx6_defconfig and make dtbs

  5. I did as explained here. These are the results of the git diff > changes.txt:

    +++ b/home/ec/linux-toradex/arch/arm/boot/dts/imx6dl-colibri-aster.dts
    @@ -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
        >;
      

    +++ 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       0x1b0b0
      
    •                   // MX6QDL_PAD_GPIO_8__GPIO1_IO08       0x1b0b0
                >;
        };
      

    @@ -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 @@
    };
    };
    };

  6. Compile the device tree with make dtbs or make imx6dl-colibri-aster.dtb and I get the following:

    ec@ec:~/linux-toradex$ make imx6dl-colibri-aster.dtb
    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
    make1: *** [arch/arm/boot/dts/imx6dl-colibri-aster.dtb] Error 1
    arch/arm/Makefile:343: recipe for target ‘imx6dl-colibri-aster.dtb’ failed
    make: *** [imx6dl-colibri-aster.dtb] Error 2`

The syntax error refers to the following line: MX6QDL_PAD_GPIO_7__FLEXCAN1_TX PAD_CTRL_HYS_PU

Any recommendations for this error? Thank you.

Kind regards.

Hi @cae30989

Thanks for writing to the Toradex Community!

First of All, for Bsp 2.8 the Kernel 4.9.2.3 is used and for Bsp 3.0 the Kernel 4.14.x.

Being said that, if you compile device-tree in the kernel branch 4…14.x, then you are not allowed to use any defines for the PAD Settings, since these does not exist any-more. These were deleted to the fact, that we are continuously adapting the device tree and kernel config to the mainline kernel.

Thus I would recommend you to use the value 0x1b0b0 instead of the #define PAD_CTRL_HYS_PU 0x1b0b0.

Best regards,
Jaski

Hi @jaski.tx,

thank you very much for the extended answer. I did as you recommended:

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

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

The compilation works.

ec@ec:~/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
  DTC     arch/arm/boot/dts/imx6dl-colibri-cam-eval-v3.dtb
  DTC     arch/arm/boot/dts/imx6dl-colibri-eval-v3.dtb
  DTC     arch/arm/boot/dts/imx6dl-colibri-iris.dtb
  DTC     arch/arm/boot/dts/imx6dl-colibri-iris-v2.dtb

I added the imx6dl-colibri-aster.dtb file to the Colibri-iMX6_LXDE-Image-Tezi_2.8b6.184 and installed it via Toradex Easy Installer. Everything so far was good. When I turned on the module I set the fdt_file with the imx6dl-colibri-aster.dtb and boot it using minicom. The following came:

U-Boot 2016.11-2.8.6+g83a53c1c0c (Apr 01 2019 - 09:53:19 +0000)

CPU:   Freescale i.MX6DL rev1.3 at 792 MHz
Reset cause: POR
I2C:   ready
DRAM:  512 MiB
PMIC:  device id: 0x10, revision id: 0x21, programmed
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
auto-detected panel vga-rgb
Display: vga-rgb (640x480)
In:    serial
Out:   serial
Err:   serial
Model: Toradex Colibri iMX6 DualLite 512MB V1.1A, Serial# 05174500
Net:   using PHY at 0
FEC [PRIME]
Hit any key to stop autoboot:  0 
Colibri iMX6 # env set fdt_file imx6dl-colibri-aster.dtb
Colibri iMX6 # boot
Booting from internal eMMC chip...
reading imx6dl-colibri-aster.dtb
** Unable to read file imx6dl-colibri-aster.dtb **
reading zImage
** Unable to read file zImage **

emmcboot failed
MMC: no card present
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
starting USB...
USB0:   Port not available.
USB1:   USB EHCI 1.00
scanning bus 1 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
       scanning usb for ethernet devices... 0 Ethernet Device(s) found

USB device 0: unknown device
BOOTP broadcast 1
DHCP client bound to address 192.168.0.21 (3 ms)
Using FEC device
TFTP from server 192.168.10.1; our IP address is 192.168.0.21; sending through gateway 192.168.0.250
Filename 'boot.scr.uimg'.
Load address: 0x17000000
Loading: T T T T T T T T T T 

I’m not sure what went wrong here.
Thank you, best regards.

HI

U-Boot 2016.11-2.8.6+g83a53c1c0c

This is U-Boot from Bsp 2.8, but you compiled the devicetree for Bsp 3.0. Could you stick to one version and mix these versions.

reading imx6dl-colibri-aster.dtb
** Unable to read file imx6dl-colibri-aster.dtb **
reading zImage
** Unable to read file zImage **

Could you check if these files are present in the boot partition of the SoM?

Best regards,
Jaski

Hi @jaski.tx,

This is U-Boot from Bsp 2.8, but you
compiled the devicetree for Bsp 3.0.
Could you stick to one version and mix
these versions

Do you mean I should just take the branch toradex_4.9-2.3.x-imx from the Linux-Kernel?

Could you check if these files are
present in the boot partition of the
SoM?

I’m sorry I don’t know what command to use to find out this information on the board.

Thanks, best regards.

HI

Do you mean I should just take the branch toradex_4.9-2.3.x-imx from the Linux-Kernel?

Yes.

I’m sorry I don’t know what command to use to find out this information on the board.

The easiest is to use the UMS Method from U-Boot.

Best regards,
Jaski

Hi @jaski.tx,

I cloned the toradex_4.9-2.3.x-imx branch from the Linux Kernel. I followed all the steps.

@@ -81,6 +81,14 @@
        status = "okay";
 };
 
+&can1 {
+       status="okay";
+};
+
+&can2 {
+       status="okay";
+};
+
 &ecspi4 {
        fsl,spi-num-chipselects = <2>;
        cs-gpios = <
@@ -145,10 +153,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
        >;
+++ b/home/ec/linux-toradex/arch/arm/boot/dts/imx6qdl-colibri.dtsi
@@ -465,14 +465,14 @@
 
                pinctrl_flexcan1: flexcan1grp {
                        fsl,pins = <
-                               MX6QDL_PAD_GPIO_7__FLEXCAN1_TX   0x80000000
-                               MX6QDL_PAD_GPIO_8__FLEXCAN1_RX   0x80000000
+                               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 0x80000000
-                               MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX 0x80000000
+                               MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX PAD_CTRL_HYS_PU
+                               MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX PAD_CTRL_HYS_PU
                        >;
                };
        };
@@ -492,8 +492,8 @@
                };
                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
+                               // MX6QDL_PAD_GPIO_7__GPIO1_IO07       PAD_CTRL_HYS_PU
+                               // MX6QDL_PAD_GPIO_8__GPIO1_IO08       PAD_CTRL_HYS_PU
                        >;
                };
        };
@@ -1084,4 +1084,3 @@
        #size-cells = <1>;
        status = "disabled";
 };
-

But again I become the same error

U-Boot 2016.11-2.8.6+g83a53c1c0c (Apr 01 2019 - 09:53:19 +0000)
                                                                                                        
CPU:   Freescale i.MX6DL rev1.3 at 792 MHz                                                              
Reset cause: POR                                                                                        
I2C:   ready                                                                                            
DRAM:  512 MiB                                                                                          
PMIC:  device id: 0x10, revision id: 0x21, programmed
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
auto-detected panel vga-rgb
Display: vga-rgb (640x480)
In:    serial
Out:   serial
Err:   serial
Model: Toradex Colibri iMX6 DualLite 512MB V1.1A, Serial# 05174500
Net:   using PHY at 0
FEC [PRIME]
Hit any key to stop autoboot:  0 
Colibri iMX6 # env set fdt_file imx6dl-colibri-aster.dtb
Colibri iMX6 # boot
Booting from internal eMMC chip...
reading imx6dl-colibri-aster.dtb
** Unable to read file imx6dl-colibri-aster.dtb **
reading zImage
** Unable to read file zImage **

emmcboot failed
MMC: no card present
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
starting USB...
USB0:   Port not available.
USB1:   USB EHCI 1.00
scanning bus 1 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
       scanning usb for ethernet devices... 0 Ethernet Device(s) found

USB device 0: unknown device
BOOTP broadcast 1
DHCP client bound to address 192.168.0.21 (3 ms)
Using FEC device
TFTP from server 192.168.10.1; our IP address is 192.168.0.21; sending through gateway 192.168.0.250
Filename 'boot.scr.uimg'.
Load address: 0x17000000
Loading: T T T T T T

I checked the output of ums 0 mmc 0 in the u-boot console:
UMS: LUN 0, dev 0, hwpart 0, sector 0x0, count 0x748000
/
and it kind of gets stuck there.
Best regards.

HI

I checked the output of ums 0 mmc 0 in the u-boot console: UMS: LUN 0, dev 0, hwpart 0, sector 0x0, count 0x748000 / and it kind of gets stuck there.

You should see two extra partitions on your host, the boot partition and root filesystem partition. Check if the files mentioned files above are present in Boot partition.

Best regards,
Jaski

Hi @jaski.tx,

unfortunately I don’t have two extra partitions on my host computer. I guess I’m making a mistake when I put everything into the Toradex Easy Installer. I’ll try again.

Best regards.

Hi @jaski.tx,

when I run make dbts does it affect the zImage?

Thanks, best regards.

No. Anyway you did not change the kernel, so you don’t need to flash a new one.
I would recommend you to start over and just change the new custom device-tree.

Best regards,
Jaski

Hi @jaski.tx,

I finally got it to work. I’m very thankful for your help! I started all over and only changed the new custom device-tree.

My last question regarding this topic is, would I always have to set the fdt_file to imx6dl-colibri-aster.dtb or is there a way to make this a default value?

Thanks, kind regards.

Perfect that it works.

You can change the variable’s value and save the Environment by the saveenv command. This should keep the value.

If you want to fix it when you flash the complete image, then you should use a U-Boot Environment file as described here.

Best regards,
Jaski