# Orange Pi Zero 2 W - Enable USB0 (host mode)

**URL:** <https://dietpi.com/forum/t/orange-pi-zero-2-w-enable-usb0-host-mode/23661>\
**Category:** Community Tutorials\
**Created:** [16 June 2025 03:07 UTC](https://dietpi.com/forum/t/orange-pi-zero-2-w-enable-usb0-host-mode/23661 "2025-06-16T03:07:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdspugh](https://dietpi.com/forum/user_avatar/dietpi.com/jdspugh/32/8003_2.png) [@jdspugh](https://dietpi.com/forum/u/jdspugh)\
**Post date:** [16 June 2025 03:07 UTC](https://dietpi.com/forum/t/orange-pi-zero-2-w-enable-usb0-host-mode/23661/1 "2025-06-16T03:07:27Z")

</div>

The Orange Pi Zero 2 W currently only support one USB port in host mode (the one further from the edge of the board). If you want to be able to use the one near the edge (USB0) you can do so by modifying the system device tree.

Decompile device tree, into user’s home directory:

`dtc -I dtb -O dts -o sun50i-h618-orangepi-zero2w.dts /boot/dtb/allwinner/sun50i-h618-orangepi-zero2w.dtb`

Modify `sun50i-h618-orangepi-zero2w.dts`

```auto
...
usb@5100000 {
  ...
  status="disabled"
  dr_mode="host"
  ...
}

usb@5101400 {
  ...
  status = "okay";
  ...
};

usb@5101000 {
  ...
  status = "okay";
  ...
};
...

```

Backup the existing system device tree:

`sudo cp /boot/dtb/allwinner/sun50i-h618-orangepi-zero2w.dtb /boot/dtb/allwinner/sun50i-h618-orangepi-zero2w.dtb.bak`

Compile the modified device tree from user’s home directory into the system location:

`sudo dtc -O dtb -o /boot/dtb/allwinner/sun50i-h618-orangepi-zero2w.dtb sun50i-h618-orangepi-zero2w.dts`

Reboot:

`sudo reboot`

I’m trying to turn this into a device tree overlay so the configuration will be easier and safer.

---

<div class="post-metadata">

**Author:** ![jdspugh](https://dietpi.com/forum/user_avatar/dietpi.com/jdspugh/32/8003_2.png) [@jdspugh](https://dietpi.com/forum/u/jdspugh)\
**Post date:** [16 June 2025 04:00 UTC](https://dietpi.com/forum/t/orange-pi-zero-2-w-enable-usb0-host-mode/23661/2 "2025-06-16T04:00:44Z")

</div>

Ok, the much safer way to set this up is using overlays. Don’t use the method above, but rather try this method first:

Create ~/sun50i-h616-usb0-host.dts

```auto
/dts-v1/;
/plugin/;

/ {
    compatible = "xunlong,orangepi-zero2w", "allwinner,sun50i-h618";

    fragment@0 {
        target = <&usbotg>;
        __overlay__ {
            dr_mode = "host";
            status = "okay";
        };
    };

    fragment@1 {
        target = <&usbphy>;
        __overlay__ {
            status = "okay";
        };
    };

    fragment@2 {
        target = <&ehci0>;
        __overlay__ {
            status = "okay";
        };
    };

    fragment@3 {
        target = <&ohci0>;
        __overlay__ {
            status = "okay";
        };
    };
};

```

Compile the overlay:

```auto
dtc -@ -I dts -O dtb -o ~/sun50i-h616-usb0-host.dtbo ~/sun50i-h616-usb0-host.dts

```

Copy it to the system directory:

```auto
sudo cp ~/sun50i-h616-usb0-host.dtbo /boot/dtb/allwinner/overlay/

```

Enable it in the DietPi environment by modyfing `/boot/dietpiEnv.txt`

```auto
sudo vim /boot/dietpiEnv.txt

```

And add these lines to it:

```auto
overlay_prefix=sun50i-h616
overlays=usb0-host

```

Save and reboot.

> **Previously**
>
> Previously I was doing the following. If the above method doesn’t work you can try it, otherwise ignore it:
> 
> Modify `~/sun50i-h616-usbhost0.dts`
> 
> ```auto
> /dts-v1/;
> /plugin/;
> 
> / {
> compatible = "allwinner,sun50i-h618";
> 
> fragment@0 {
> target-path = "/soc/usb@5100000";
> __overlay__ {
> status = "disabled";
> dr_mode = "host";
> };
> };
> 
> fragment@1 {
> target-path = "/soc/usb@5101400";
> __overlay__ {
> status = "okay";
> };
> };
> 
> fragment@2 {
> target-path = "/soc/usb@5101000";
> __overlay__ {
> status = "okay";
> };
> };
> };
> 
> ```
> 
> Compile the overlay:
> 
> `dtc -@ -I dts -O dtb -o ~/sun50i-h616-usbhost0.dtbo ~/sun50i-h618-orangepi-zero2w-usb0-host-mode-overlay.dts`
> 
> Copy it to the system directory:
> 
> `sudo cp sun50i-h616-usbhost0.dtbo /boot/dtb/allwinner/overlay`
> 
> Enable it in the DietPi environment by modyfing `/boot/dietpiEnv.txt`
> 
> Append this overlay to any others on the line `overlays=` e.g.:
> 
> `overlays=usbhost0`
> 
> Save and reboot.

---

<div class="post-metadata">

**Author:** ![system](https://dietpi.com/forum/uploads/default/original/1X/7e1021de2213860bce185915ce2c1786e56490ec.png) [@system](https://dietpi.com/forum/u/system)\
**Post date:** [13 December 2025 04:01 UTC](https://dietpi.com/forum/t/orange-pi-zero-2-w-enable-usb0-host-mode/23661/3 "2025-12-13T04:01:29Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
