Enable SPI iMX6ULL

This answer is a complete fail: iMX6ULL Rebuild Yocto Image

tryed this:

bitbake -c cleansstate virtual/kernel

then the imx6ull-colibri-eval-v3.dtsi is also deleted, so I cannot modify the SPI section:

&ecspi1 {
	status = "okay";

	mcp2515: can@0 {
		compatible = "microchip,mcp2515";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_can_int>;
		reg = <0>;
		clocks = <&clk16m>;
		interrupt-parent = <&gpio2>;
		interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
		spi-max-frequency = <10000000>;
		vdd-supply = <&reg_3v3>;
		xceiver-supply = <&reg_5v0>;
		status = "disabled";
	};

        spidev0: spidev@0 {
                compatible = "toradex,evalspi";
                reg = <0>;
                spi-max-frequency = <23000000>;
                status = "okay";
        };
};

Then executed:

bitbake tdx-reference-minimal-image

SPI is still not available, another day left with no proper answer. -_-

What are the steps for modifying the .dtsi file and then rebuilding the image?
Please help.

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 there!

I understand you’re having some trouble enabling SPI on your iMX6ULL module. Let’s walk through the process to modify the device tree and rebuild your Yocto image without losing your changes.

  1. Set Up Your Yocto Environment:
    Make sure your Yocto build environment is correctly set up with all necessary layers and configurations for your Toradex module.

  2. Modify the Device Tree:

    • Locate the imx6ull-colibri-eval-v3.dtsi file.
    • Open it and find the SPI node, such as &ecspi1.
    • Change the status of the spidev node to "okay" to enable it.
    • Save your changes.
  3. Avoid Deleting Source Files:
    Instead of using bitbake -c cleansstate virtual/kernel, which deletes source files, use bitbake -c devshell virtual/kernel. This opens a development shell where you can safely make changes.

  4. Rebuild the Device Tree:

    • Run bitbake -f -c compile virtual/kernel to force the recompilation of the kernel with your modified device tree.
  5. Rebuild the Yocto Image:

    • Execute bitbake tdx-reference-minimal-image to create a new image with your changes.
  6. Deploy and Verify:

    • Flash the new image onto your module using the appropriate method, such as the Toradex Easy Installer.
    • Boot your module and check for SPI devices under /dev/. You should see entries like /dev/spidevX.Y if SPI is enabled correctly.

By following these steps, you should be able to enable SPI on your iMX6ULL module. If you run into any issues, double-check your modifications and ensure the build process completes without errors.

I hope this helps! Feel free to reach out if you have more questions.

Best regards,
Toradex AI Assistant.

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

Yocto: updating installed package after recipe changes.

Hello,
From the looks of it, you are directly modifying the dtsi from your build stash as opposed to applying it during the build process. This would not work as the device tree binary is already compiled, and as such the included device tree source has been built into it.
I would recommend creating a patch that gets applied to imx6ull-colibri-eval-v3.dtsi.
Or you can create your device tree, include imx6ull-colibri-eval-v3.dts, and just make the changes you need in that file. such as:

/dts-v1/;
#include "imx6ull-colibri-eval-v3.dts"
/{`
    model="my custom device tree"
};
&ecspi1 {
 //your custom configs
}

Note: You can include any device tree source, not just dtsi

If you don’t want to set up the patch and would rather do a quick check, you can use the dtc tool to decompile imx6ull-colibri-eval-v3.dtb, this would encapsulate the information contained in the dtsi include and you can make the modification there, recompile it back to a dtb and add that to the image source.
I would also recommend changing the model name in the .dts and checking the first line of dmesg on start up to ensure that the new device tree got loaded properly