xdrdp
Posts: 1
Joined: Tue Jun 22, 2021 5:16 pm

Adding device tree overlay makes board unbootable

Tue Jun 22, 2021 5:35 pm

Hello I want to add a device tree overlay in order to enable my custom driver. My driver utilizes pwm so I also need pwm overlay in order to make everything working.

So starting from pwm.
I've added an appropriate entry to /boot/config.txt
Now it contains:
dtoverlay=pwm

Up to this point, everything works fine.
Things get complicated when I want to add another overlay describing my device.
I did this by adding my overlay file to /boot/overlay (the same place where the pwm overlay is located).

Then I added another entry to /boot/config.txt:
dtoverlay=hatch2sr

So my config.txt looks like this (I skipped irrelevant part):
dtoverlay=pwm
dtoverlay=hatch2sr

Everything is supposed to work fine, but in fact, it doesn't.

When the board is being booted, I'm getting an error:

Code: Select all

ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
SCRIPT FAILED: continuing...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disk mmc@7e202000.blk...
Card did not respond to voltage select! : -110
Scanning disk sdhci@7e300000.blk...
Disk sdhci@7e300000.blk not ready
Found 3 disks
No EFI system partition
ERROR: invalid device tree
Card did not respond to voltage select! : -110
 
Device 0: unknown device
No ethernet found.
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm-bcm283x-rpi
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm-bcm283x
No ethernet found.
missing environment variable: bootfile

But what makes it unbootable? What is the origin of this problem?

Another interesting thing is when I remove either dtoverlay=pwm or dtoverlay=hatch2sr (leaving one of them enabled in config) board boots properly. Why these two overlays seem to be conflicted somehow?

My custom device tree overlay(I'm using the newset syntax available since dtc 1.5)

Code: Select all

/dts-v1/;
/plugin/;
 
&soc {
  hatch2sr {
      compatible = "hatch2sr";
 
      pwm-names = "motor1";
      pwms  = <&pwm 0 1000000>;
      gpios = <&gpio 24 1>,  // 0 -> GPIIO_ACTIVE_HIGH, 1 -> GPIO_ACTIVE_LOW
              <&gpio 23 1>,
              <&gpio 25 1>;
 
      };
};
Hardware: RaspberryPi Zero W
Build system: Yocto
Linux Kernel: 5.10.31
Uboot: U-Boot 2021.01

I'm actually looking for some advice where to start looking for the place where things may be wrong configured or something, because - honestly I've tried multiple version of device tree configuration but none of them have worked.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3953
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Adding device tree overlay makes board unbootable

Wed Jun 23, 2021 4:49 pm

I don't recommend writing overlays in the new syntax, but this one works for me in that it doesn't stop a Pi (4B, in this case) from booting. Of course, I don't have your driver installed. Try changing the compatible string so that your driver doesn't load and see if you get further.

Return to “Device Tree”