Device Tree Customization for SSI and GPIOs

Hi,
We are using Colibri iMX6 DualLite 512MB V1.1A in Colibri Evaluation Board V3.2B with Custom Linux Image developed using OE/YOCTO from Linux Image V2.8.
We need to interface some sensors with SPI communication. For that I referred this link. It says,

By default our BSP uses the MCP2515 SPI CAN controller as available on our Colibri Evaluation board V3.x. In order to use spidev instead one needs to disable (e.g. status = “disabled”) the mcp2515 device tree node and enable (e.g. status = “okay”) the spidev one and re-generate and deploy the device tree to the target.

Is Device Tree configuration is the only way to enable SPI module? Isn’t there any single SPI module which are available by default so that we can directly use?

For doing device tree customization, I referred this link. Since we are using a Custom made OS using YOCTO/OE, should we need to do any changes in this method.

And in the Guest webinar:Demystifying Device Tree for NXP® i.MX Processors, they use tftp boot, to upload the newly generated .dtb file. I haven’t used tftp boot yet. Is there any alternative for that?

Thank you for your time.

hello @goofy

As far for flashing/update image is concerned you can use mmc(sd card) or usb following this link

regards

ryan

Thank Ryan.
The link that you’ve provided describes flashing the linux OS using Toradex Easy Installer or the legacy method. But in my case, I have to update only the device configuration bin file (.dtb file).

@goofy
please lookup for “Update a Single Component” in that link

Thank Ryan.
Sorry, I didn’t notice that. But still it is not clear. Should I need to put the .dtb file in the sd card/pen drive and try running the commands as mentioned in the link?

Colibri iMX6 # run setupdate
Colibri iMX6 # run update_kernel
Colibri iMX6 # run update_fdt

Could you please explain the process of loading the .dtb file into the SoM in detail?

Thank You for your time.

HI @goofy

Thanks for writing to the Toradex Community!

Is Device Tree configuration is the only way to enable SPI module?

Yes, the Device Tree configuration is the only way to enable SPI.

Isn’t there any single SPI module which are available by default so that we can directly use?

No, you really need to compile a custom device-tree.

For doing device tree customization, I referred this link. Since we are using a Custom made OS using YOCTO/OE, should we need to do any changes in this method.

Usually not, if you change the device-tree name, then you need to adapt this in your configuration. The Link you provided in Vybrid modules. Make sure to use the Information for Colibri iMX6 module.

And in the Guest webinar:Demystifying Device Tree for NXP® i.MX Processors, they use tftp boot, to upload the newly generated .dtb file. I haven’t used tftp boot yet. Is there any alternative for that?

As @ryan explained, you can use the legacy update and just replace the .dtb file in the SD card or USB Key and then do run setupdate and run update_fdt from U-Boot.

Another alternative, which works for Modules featuring eMMC Flash (like iMX6 and other …), you can mount the eMMC Flash as an UMS device on your host. You need to connect the OTG cable for this to your host. Once this is done, then just stop in U-Boot and type the following:

ums 0 mmc 0

Once the boot and rootfs partition is mounted in your host, you can just replace the device-tree from the boot partition of the SoM with your device-tree.

Best regards,
Jaski

Thank You for your detailed answer.
Actaully, I’m facing a problem in downloading the linux kernel source code.

The device trees are part of the Linux
kernel source code and located in the
arch/arm/boot/dts/ folder. For
instructions of how to obtain the
Linux source code for each module,
refer to the article Build U-Boot and
Linux Kernel from Source Code.

I tried to download the Linux Kernel from this link. The Custom Linux OS which developed was Colibri-iMX6_LXDE-Image-Tezi_2.8b6-20190819.tar i.e. from the Linux 2.8b6. But the iMX6 Linux Kernel Versions given in this link is upto 2.8b5 and skips to 3.0. Which one should I download?

And I tried to download for 2.8b5. For that I have used the command,

git clone -b toradex_4.9-2.3.x-imx git://git.toradex.com/linux-toradex.git

The download happens fine upto 99% but stops after that. I have tried 2 times with different Internet connectivity. The problem is not resolved. Is that command correct? I don’t know why this is happening.

Thank You for your time.

Hi

You are welcome.

I tried to download the Linux Kernel from this link. The Custom Linux OS which developed was Colibri-iMX6_LXDE-Image-Tezi_2.8b6-20190819.tar i.e. from the Linux 2.8b6. But the iMX6 Linux Kernel Versions given in this link is upto 2.8b5 and skips to 3.0. Which one should I download?

The kernel version after 2.8.5 for Bsp 2.8 did not change. Its toradex_4.9-2.3.x-imx.

The download happens fine upto 99% but stops after that. I have tried 2 times with different Internet connectivity. The problem is not resolved. Is that command correct? I don’t know why this is happening.

We checked this internally and the git server is working fine. Are you still having issues downloading the kernel?

Best regards,
Jaski

Hi
I’ve created a new folder named ‘device tree customization’ inside the home folder and tried downloading into that.
This time the download is completed 100% but the control was not released in the Ubuntu terminal. I’ve attached screenshot of the my terminal. alt text. Is this supposed to be like this?

I then opened the ‘device tree customization’ folder. In that, a new folder named ‘linux-toradex’ is created. I opened it. No files were present. I tried to view the hidden files by pressing Ctrl + H. Only one folder named ‘.git’ was present. It has the following folders.

.

├── branches
├── config
├── description
├── HEAD
├── hooks
│   ├── applypatch-msg.sample
│   ├── commit-msg.sample
│   ├── post-update.sample
│   ├── pre-applypatch.sample
│   ├── pre-commit.sample
│   ├── prepare-commit-msg.sample
│   ├── pre-push.sample
│   ├── pre-rebase.sample
│   └── update.sample
├── info
│   └── exclude
├── objects
│   ├── info
│   └── pack
│       ├── pack-74b0fde5dcbfaf8e98a5f4dd82286d8117c64eee.idx
│       ├── pack-74b0fde5dcbfaf8e98a5f4dd82286d8117c64eee.keep
│       ├── pack-74b0fde5dcbfaf8e98a5f4dd82286d8117c64eee.pack
│       └── Untitled Folder
└── refs
    ├── heads
    └── tags

But there is no folder like ‘arch/arm/boot/zImage’ . Is there any other method to download instead of git clone.

Thank You.

HI @goofy

Is this supposed to be like this?

This is strange in your case. Usually this works just fine.

But there is no folder like ‘arch/arm/boot/zImage’ . Is there any other method to download instead of git clone?

Could you go to the folder linux-toradex and type the following commands and share the output in text format (no screenshot)?

uname -a
git --version
git status  
git config --list

Thanks and best regards,
Jaski

Hi
I’ve mentioned that a new folder named ‘linux-toradex’ was created. But the terminal control has hanged after that. I pressed Ctrl + C inside the termian to break the process. But after that the newly created folder has disappeared.
I ran the commands that you’ve given in the previous folder. It gave the following result.

uname -a

Linux raghul-Latitude-3500
4.15.0-55-generic #60~16.04.2-Ubuntu SMP Thu Jul 4 09:03:09 UTC 2019 x86_64
x86_64 x86_64 GNU/Linux

git --version

git version 2.7.4

git status

fatal: Not a git repository (or any
parent up to mount point /home)
Stopping at filesystem boundary
(GIT_DISCOVERY_ACROSS_FILESYSTEM not
set).

git config --list

user.email=raghulnm31@gmail.com
user.name=raghul color.ui=auto

Hi, Thanks for your Input.

Could you try to replace the server with git1 or git2 as the following:

git clone -b toradex_4.9-2.3.x-imx git://git1.toradex.com/linux-toradex.git
git clone -b toradex_4.9-2.3.x-imx git://git2.toradex.com/linux-toradex.git

And check if this works.

Best regards,
Jaski

Hi
I’ve tried with both the links. Same problem. Stops at 99%.
But the ‘linux-toradex’ folder was created. I’ve executed the commands you’ve given before, inside that folder.

uname -a

Linux raghul-Latitude-3500
4.15.0-55-generic #60~16.04.2-Ubuntu SMP Thu Jul 4 09:03:09 UTC 2019 x86_64
x86_64 x86_64 GNU/Linux

git --version

git version 2.7.4

git status

On branch master
Initial commit
nothing to commit (create/copy files
and use "git add" to track)

git config --list

user.email=raghulnm31@gmail.com
user.name=raghul color.ui=auto
core.repositoryformatversion=0
core.filemode=true core.bare=false
core.logallrefupdates=true
remote.origin.url=git://git1.toradex.com/linux-toradex.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*

I’ll try once again.

I’ve done adding a new recipe using YOCTO and developed a custom OS. Can I do the device tree modification using YOCTO/OE?

Hi @goofy

So if the folder linux-toradex was created then you can do git fetch and git pull to get the files. Or you start over by cloning from https instead of git.

git clone -b toradex_4.9-2.3.x-imx https://git.toradex.com/linux-toradex.git

I’ve done adding a new recipe using YOCTO and developed a custom OS. Can I do the device tree modification using YOCTO/OE?

Sure, you can upload the device tree changes to YOCTO and builld a custom image.

Best regards,
Jaski

Thank You.
I’ll try with the git fetch and git pull commands.

For doing the device tree modification using YOCTO, whether the device tree source file (.dts file) will be available in the build directory itself? Or it will contain only the device tree binary files (.dtb) ?

Thank You for your time.

Thank You. I’ll try with the git fetch and git pull commands.

Ok, perfect.

For doing the device tree modification using YOCTO, whether the device tree source file (.dts file) will be available in the build directory itself? Or it will contain only the device tree binary files (.dtb) ?

I don’t understand your question. In the build image, the devicetree will be in binary format.

best regards,
Jaski

Hi
I’ve already added a recipe using YOCTO and made a custom OS. So in the build directory I could able to find the Device Tree Configuration file - ‘imx6dl-colibri-eval-v3.dts’. The path for the file is given below.

/yocto/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts

If I edit the file as given in this link and bitbake a new custom OS, will I be able to access the SPI?

Thank You for your time.

Sure. You just need to flash the compiled .dtb file to the module.

Dear @goofy,

Yes, you should be able to SPI by modifying the device tree of the kernel source in the work-shared directory and then force recompile using bitbake -f -c compile virtual/kernel in Yocto

Let me know the results.

Thank You.
Won’t that .dtb file be as a part of the image generated - “Colibri-iMX6_LXDE-Image-Tezi_2.8b6.tar”, so that I can directly extract into a pen drive and install the OS into SoM using Easy Installer?