Device tree loading Colibri iMX7D

Hi,
I am new to Linux Software, I have done configuration in host computer as given in following link Build U-Boot and Linux Kernel from Source Code | Toradex Developer Center.

and have tried to compiled device tree customization given in following link Device Tree Customization | Toradex Developer Center.

make -j3 zImage 2>&1 | tee build.log
make imx7d-colibri-eval-v3.dtb are successful.

I need to customize device tree for SPI. Before that, with default setting dtb file to load in our target board. Kindly guide me how to load dtb file to target board.

You can use several methods to replace an existing DTB file

U-Boot

Method 1:
DTB files are stored at mmc 0 partition 1. You can see it by ls mmc 0:1 command. You can load new DTB file from SD card or USB frive to memory using load command. Than save it to partition 1 using save mmc 0:1 command

Method 2:
Put your new DTB file to USB drive or SD card and modify emmcboot environment variable (see load mmc 0:1 ${fdt_addr_r} ${soc}-colibri-emmc-${fdt_board}.dtb there) to load new dtb file from your device instead of mmc 0:1

Linux

Boot partition with DTB files is /dev/mmcblk0p1. And it mounted on /media/mmcblk0p1. So you can use a cp command to replace DTB file and then reboot your system.

TEZI

Download TEZI image from here - Downloads & Installers | Toradex Developer Center .

Unpack it to SD card or USB drive.

Replace a dtb file at Colibri-iMX7-eMMC_LXDE-Image.bootfs.tar.xz
Start TEZI and re-flash a whole system using modified image.

Hi,
Thanks for guidance. As instructed upon trying UBOOT
Method1: I have obtained the following results

Colibri iMX7 # load mmc 0:1 imx7d-colibri-emmc-eval-v3.dtb
load - load binary file from a filesystem

Usage:
load [ [ [ [bytes [pos]]]]]
- Load binary file ‘filename’ from partition ‘part’ on device
type ‘interface’ instance ‘dev’ to address ‘addr’ in memory.
‘bytes’ gives the size to load in bytes.
If ‘bytes’ is 0 or omitted, the file is read until the end.
‘pos’ gives the file byte position to start reading from.
If ‘pos’ is 0 or omitted, the file is read from the start.

Method 2 fetched me following results.
Colibri iMX7 # load imx7-colibri-emmc-eval-v3.dtb
** Bad device specification 0x80800000 imx7-colibri-emmc-eval-v3 **

Kindly provide an example for Method2 for $load address.

Usage:
load [ [ [ [bytes [pos]]]]]

- Load binary file 'filename' from partition 'part' on device
   type 'interface' instance 'dev' to address 'addr' in memory.
  'bytes' gives the size to load in bytes.
  If 'bytes' is 0 or omitted, the file is read until the end.
  'pos' gives the file byte position to start reading from.
  If 'pos' is 0 or omitted, the file is read from the start.

Examples:

load mmc 0:1 0x80800000 abc.dtb
load file abc.dtb using mmc subsystem form device 0 (internal eMMC) partition 1 to memory location at 0x80800000

SD card is a device #1

To load from USB you need to start USB subsystem first using command usb start

Hi,

Thanks for Example

load mmc 0:1 0x80800000 imx7d-colibri-emmc-eval-v3.dtb
command is working and obtained the following results
reading imx7d-colibri-emmc-eval-v3.dtb
45032 bytes read in 17 ms (2.5 MiB/s)

but, not able to save file, the save command outputs

Colibri iMX7 # save mmc 0:1
save - save file to a filesystem

Usage:
save bytes [pos]
- Save binary file ‘filename’ to partition ‘part’ on device
type ‘interface’ instance ‘dev’ from addr ‘addr’ in memory.
‘bytes’ gives the size to save in bytes and is mandatory.
‘pos’ gives the file byte position to start writing to.
If ‘pos’ is 0 or omitted, the file is written from the start.

after loading and saving the file. What is next step? Rebooting or Run Update Command ? Kindly specify

Kindly guide me to finish loading the file in other methods too.

Hi,

On Applying the Load Command

load mmc 0:1 0x80800000 imx7d-colibri-emmc-eval-v3.dtb

and upon rebooting.
I got the following results.

U-Boot 2016.11-2.7.4+g1b121c6 (Oct 04 2017 - 21:46:51 +0000)

CPU: Freescale i.MX7D rev1.2 996 MHz (running at 792 MHz)
CPU: Extended Commercial temperature grade (-20C to 105C) at 48C
Reset cause: POR
DRAM: 1 GiB
PMIC: RN5T567 LSIVER=0x01 OTPVER=0x0d
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Video: 640x480x18
In: serial
Out: serial
Err: serial
Model: Toradex Colibri iMX7 Dual 1GB V1.1A, Serial# 02997286
Net: FEC0
Hit any key to stop autoboot: 0
Booting from internal eMMC chip…
reading imx7d-colibri-emmc-my-carrier-board.dtb
** Unable to read file imx7d-colibri-emmc-my-carrier-board.dtb **

emmcboot failed
MMC: no card present
starting USB…
USB0: USB EHCI 1.00
scanning bus 0 for devices… 1 USB Device(s) found
USB1: USB EHCI 1.00
scanning bus 1 for devices… 2 USB Device(s) found
scanning usb for storage devices… 1 Storage Device(s) found

USB device 0:
Device 0: Vendor: General Rev: 5.00 Prod: UDisk
Type: Removable Hard Disk
Capacity: 481.0 MB = 0.4 GB (985088 x 512)
… is now current device
Scanning usb 0:1…
BOOTP broadcast 1
DHCP client bound to address 192.168.15.84 (33 ms)
Using FEC0 device
TFTP from server 192.168.15.1; our IP address is 192.168.15.84
Filename ‘boot.scr.uimg’.
Load address: 0x87000000
Loading: T T T

Also, help with the following error

Colibri iMX7 # load mmc 0:1 0x87000000 imx7d-colibri-mohan.dtb
reading imx7d-colibri-mohan.dtb
** Unable to read file imx7d-colibri-mohan.dtb **

As Per Linux Command the Loading of dtb file from host system.

The dev folder does not contain folder /mmcblk0p1/ for boot partition.

Kindly specify the proper folder structure.

It seems that the device tree is not on the first MMC partition as it should be. Can you check

ls mmc 0:1

There are many methods how to write a device tree to the first partition of the eMMC, as alex.tx already described. Yet another one which I often use is using the USB mass storage emulation. If you connect your carrier board USB client to your host, you will see the eMMC as a mass storage device. You should find two partitons, the first contains the kernel image (zImage) and the default device trees. You then can conveniently copy the newly build device tree over USB to the internal eMMC.

Yes I did check
Colibri iMX7 # ls mmc 0:1
5114880 zimage
45032 imx7d-colibri-emmc-eval-v3.dtb
43984 imx7d-colibri-emmc-aster.dtb
Attached Image shows the dev folder which does not contain /mmcblk0p1/ folder.
I am able to locate /media/mmcblk0p1/ which contains default device tree files and zImage.

and also Save command is not working

Kindly help.
alt text

After Successfully generating dtb file, we moved only imx7d-colibri-emmc-eval-v3.dtb file to target board. After rebooting it got stuck. i have attached the log file link text

and please find our dtb file link text
and other related files from our host computer link text

Kindly confirm are we going in right procedure.
and give me solution.

The log file seems to be empty, can you attach again?

Log file link text

It seems you are using the wrong device tree? You attached imx7d-colibri-eval-v3.dtb which is meant for the raw NAND variants (Colibri iMX7D 512MB). You need to use the imx7d-colibri-emmc-eval-v3.dtb for the Colibri iMX7 1GB.

Thanks. I have moved only imx7d-colibri-emmc-eval-v3.dtb file into the target board
and the system is booting successfully. How do i check if my spidev is enabled.
i have tried
root@colibri-imx7-emmc:~# dmesg | grep spi
[ 1.045804] spi_imx 30840000.ecspi: probed

kindly guide me.

The spidev should appear in /dev/… Is it not there?

You should not replace the zImage since it will make kernel module not loading anymore.

See also SPI (Linux).

No I did not move zImage. I am not able to find spidev in /dev/ folder

I can only find /sys/class/spidev/spidev2.0

guide me to config spidev.

@narayanamohan: Could you share your emmc dtb file, please? Thanks.

Yes. Kindly find attached imx7d-colibri-emmc-eval-v3.dtb

link text

Kindly check and reply. Thanks.

Hi @narayanamohan, I flashed your dtb file and i can see a spidev2.0 under /dev.
Could you provide the output of following commands: cat /etc/issue and ls /dev/ | grep spi.

Thanks and best regards