Orange Pi One USB-OTG


 Share

1 1

Recommended Posts

There are two USB dongles on my Orange Pi One box, one is a USB Bluetooth in USB-OTG port and other is a mu7601 USB WiFi in the USB port. When I switched it from legacy kernel to lastest development kernel 4.11.x, the bluetooth card disappeared. So I exchange two dongles each other , the one in USB port works, and the one in USB-OTG port always failed.

 

Is there any solution?

Link to post
Share on other sites

Armbian is a community driven open source project. Do you like to contribute your code?

On 2017/7/31 at 0:29 AM, kutysam said:

nano /boot/armbianEnv.txt

 

add in this overlay

overlays=usbhost0

 

but there is a bug if you reboot. I'm posting the bug right now.

 

Thanks, but don't works. 

 

In fact I've tried every usbhostX overlay before post this topic.

Link to post
Share on other sites

1 hour ago, kutysam said:

Yeap. I'm the OP in that thread. Do try plugging in the otg,  only after your pi has fully loaded. It may work for the momment.

 

dmesg | grep usb0

 

[    3.165850] reg-fixed-voltage usb0-vbus: could not find pctldev for node /soc/pinctrl@01f02c00/usb0_vbus_pin@0, deferring probe
[    3.906543] usb0-vbus: disabling

 

 

Link to post
Share on other sites

11 hours ago, mantouboji said:

martinayotte said  he will release  a patch. 

I'm still working on it, it is more difficult than expected, because it shares sunxi-common-regulators.dtsi between H3-H5 and A20 and others.

My current version is enabling the PL2, but I can't make "/delete-node/" working to remove PB9, and the dmesg error still present.

I also need to verify if USB0 is actually powered, but unfortunately my OTG adaptor is a Mini-USB not Micro-USB, I will need to sacrifice a Micro cable and solder a female connector on it...

 

Link to post
Share on other sites

12 hours ago, martinayotte said:

I'm still working on it, it is more difficult than expected, because it shares sunxi-common-regulators.dtsi between H3-H5 and A20 and others.

My current version is enabling the PL2, but I can't make "/delete-node/" working to remove PB9, and the dmesg error still present.

I also need to verify if USB0 is actually powered, but unfortunately my OTG adaptor is a Mini-USB not Micro-USB, I will need to sacrifice a Micro cable and solder a female connector on it...

 

 

USB0 is actually powered on opi lite. i connected my webcam to an otg adapter and it works fine. (full resolution)

Do let me know if there is any tests i can do to help out :)

Link to post
Share on other sites

On 2017/8/19 at 3:43 AM, martinayotte said:

 

no works:

 

yaofei@opione1:~$ dmesg  | grep usb0
[    3.165900] reg-fixed-voltage usb0-vbus: could not find pctldev for node /soc/pinctrl@01f02c00/usb0_vbus_pin@0, deferring probe
[    3.906582] usb0-vbus: disabling
yaofei@opione1:~$ uname -a
Linux opione1 4.11.12-sun8i #19 SMP Wed Aug 23 23:51:57 CST 2017 armv7l armv7l armv7l GNU/Linux

Link to post
Share on other sites

On 2017/08/23 at 0:09 PM, mantouboji said:

no works:

 

yaofei@opione1:~$ dmesg  | grep usb0
[    3.165900] reg-fixed-voltage usb0-vbus: could not find pctldev for node /soc/pinctrl@01f02c00/usb0_vbus_pin@0, deferring probe
[    3.906582] usb0-vbus: disabling

 

While I've done the patch, I tested it on OPiLite, and it work without any tuning.

Today, just to verify, I've built an image for OPiOne, but did worked at first : I had to tweak the DT to switch the "dr-mode" to "host" since it was defaulted to "otg".

After reboot, it worked !

 

BTW, the message "deferring probe" is still present even if working later, but you should not see "usb0-vbus: disabling".

Which image are you using ?

 

Link to post
Share on other sites

On 2017/8/26 at 10:25 PM, martinayotte said:

 

While I've done the patch, I tested it on OPiLite, and it work without any tuning.

Today, just to verify, I've built an image for OPiOne, but did worked at first : I had to tweak the DT to switch the "dr-mode" to "host" since it was defaulted to "otg".

After reboot, it worked !

 

BTW, the message "deferring probe" is still present even if working later, but you should not see "usb0-vbus: disabling".

Which image are you using ?

 

 

I built it in your git tree, no any modification.

Welcome to ARMBIAN 5.31 stable Ubuntu 16.04.3 LTS 4.11.12-sun8i
System load:   0.11 0.06 0.01  	Up time:       5 days
Memory usage:  10 % of 464MB  	IP:            192.168.20.200,192.168.20.172
CPU temp:      52°C
Usage of /:    30% of 7.2G

[ 0 security updates available, 4 updates total: apt upgrade ]
Last check: 2017-08-29 00:00

[ General system configuration: armbian-config ]
Last login: Thu Aug 24 02:08:46 2017 from 192.168.20.40


yaofei@opione:~$
yaofei@opione:~$
yaofei@opione:~$ uname  -a
Linux opione 4.11.12-sun8i #19 SMP Wed Aug 23 23:51:57 CST 2017 armv7l armv7l armv7l GNU/Linux

 

Link to post
Share on other sites

On 2017/8/30 at 0:27 AM, martinayotte said:

Of course !

Decompile the DTB using "dtc" compiler, edit the resulting source by changing "dir-mode" to "host", and recompile the DTB.

Of course, make sure to do a backup of the DTB before overwriting it ...

 

 

That's all right! It works!

Link to post
Share on other sites

Hello,

I would like to use the micro USB as host (not as OTG) in order to connect a USB cam since CSI is not supported.

Running Armbian 5.32 mainline 4.11.7 .

Can you please point me to any tutorial or guide on how to do it. Unfortunately I do not know how to decompile DTB what you proposed above.

Really appreciate your help with more details.

Thank you. zsix

Link to post
Share on other sites

Hi,

 

I've been struggling also with all the info in this thread but finally succeeded to make decompile/edit/compile the dtb file (assume this file as BIOS for ARM :) )

I'm putting all commands here as reference for me as well :

 

cd /boot/dtb
sudo cp sun8i-h3-orangepi-one.dtb sun8i-h3-orangepi-one.dtb.old
sudo dtc -I dtb -O dts -o sun8i-h3-orangepi-one.dts sun8i-h3-orangepi-one.dtb
sudo sed -i -e 's/dr_mode = "otg";/dr_mode = "host";/g' sun8i-h3-orangepi-one.dts
sudo dtc -I dts -O dtb -o sun8i-h3-orangepi-one.dtb sun8i-h3-orangepi-one.dts

Explanation of different lines:

 

1. go to dtb directory

2. make backup of the compiled file in case something goes wrong

3. decompile the file to be able to alter it with text editor

4. change the string from "otg" to "host"

5. compile the altered file back to binary format dtb

 

 

The only bad thing with all this above is that if you upgrade your kernel the info will be lost so you have to do it again.

I don't get why this parameter is set by default to "otg"?

Link to post
Share on other sites

11 hours ago, surenz said:

I don't get why this parameter is set by default to "otg"?

Because then it can be used as host or peripheral depending on the type of connected cable without recompiling/patching anything.

 

8 hours ago, Igor said:

This OTG <> HOST switcher is planned for some time to find a place in armbian-config.

If it's really required it's easier to add an overlay IMO, or rather 2 overlays - for the host mode and for the peripheral mode.

Link to post
Share on other sites

On 11/28/2017 at 7:12 PM, surenz said:

Hi,

 

I've been struggling also with all the info in this thread but finally succeeded to make decompile/edit/compile the dtb file (assume this file as BIOS for ARM :) )

I'm putting all commands here as reference for me as well :

Very good effort mate, I followed your instructions and successfully changed OTG port to host mode on my A20 lime board.

It was really necessary for me because this board has got only 2 USB ports.

Just only for record I did it on kernel version 4.14.15-sunxi and it was really hard to find complete instructions.

Link to post
Share on other sites

Many thanks.
Changed the microUSB from OTG to host mode on the OPI ZERO PLUS 2 board.

With changes for this board (sun8i-h3-orangepi-zeroplus2.dtb):

 

cd /boot/dtb

sudo cp sun8i-h3-orangepi-zeroplus2.dtb sun8i-h3-orangepi-zeroplus2.dtb.old
sudo dtc -I dtb -O dts -o sun8i-h3-orangepi-zeroplus2.dts sun8i-h3-orangepi-zeroplus2.dtb
sudo sed -i -e 's/dr_mode = "peripheral";/dr_mode = "host";/g' sun8i-h3-orangepi-zeroplus2.dts
sudo dtc -I dts -O dtb -o sun8i-h3-orangepi-zeroplus2.dtb sun8i-h3-orangepi-zeroplus2.dts

 

I changed the line manually in a file "sun8i-h3-orangepi-zeroplus2.dts":

Old (OTG):

dr_mode = "peripheral";

New (host):

dr_mode = "host";

 

 

usb_otg = "/soc/usb@01c19000";

 

        usb@01c19000 {
            compatible = "allwinner,sun8i-h3-musb";
            reg = <0x1c19000 0x400>;
            clocks = <0x6 0x20>;
            resets = <0x6 0x11>;
            interrupts = <0x0 0x47 0x4>;
            interrupt-names = "mc";
            phys = <0x1a 0x0>;
            phy-names = "usb";
            extcon = <0x1a 0x0>;
            status = "okay";
            dr_mode = "peripheral";
            linux,phandle = <0x46>;
            phandle = <0x46>;
        };

Link to post
Share on other sites

Thanks for the information in this thread, it worked....then after about 2 weeks 24x7 usage, I had a crash on my Orange Pi One (not related to USB functionality I don't think, the system was probably doing a database import at the time).

After this, the OTG port didn't seem to work any more in host mode.  I tracked it down to not being any internal power on the the port, the USB data lines were OK.  Examining the board schematic shows the power for the OTG port comes through 'U11' which in turn is controlled by a line from the H3 chip, but as my board didn't have U11 on the silkscreen I didn't get much further than that.

I assumed I'd blown up that part of the board as nothing seemed to fix it and the rest of the system continued to work flawlessly after a reboot.  That was not the case however, as a complete reinstall (Armbian stretch) from scratch and hey presto, the internal USB power is restored.

In case it happens again, anyone have any idea how to troubleshoot powering of the OTG port in USB host mode when/if it goes wrong?

Link to post
Share on other sites

i've wrapped these commands into a script to modify any dtb

#!/bin/sh
# turn on microusb otg port in armbian (work as host)
# solution from https://forum.armbian.com/topic/4814-orange-pi-one-usb-otg/

FILE=$1
BACKUP=$FILE.bak
SRC="tmp.dts"

cp "$FILE" "$BACKUP"
dtc -I dtb -O dts -o "$SRC" "$FILE"
sed -i -e 's/dr_mode = "otg";/dr_mode = "host";/g' "$SRC"
dtc -I dts -O dtb -o "$FILE" "$SRC"
rm "$SRC"

 

Edited by Mintytail
script update: remove temporary files
Link to post
Share on other sites

Guest
This topic is now closed to further replies.
 Share

1 1