mantouboji Posted July 29, 2017 Posted July 29, 2017 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?
kutysam Posted July 30, 2017 Posted July 30, 2017 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.
mantouboji Posted August 1, 2017 Author Posted August 1, 2017 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.
kutysam Posted August 3, 2017 Posted August 3, 2017 overlays=usbhost0 usbhost1 usbhost2 usbhost3 still not working?? dmesg?
mantouboji Posted August 4, 2017 Author Posted August 4, 2017 16 hours ago, kutysam said: overlays=usbhost0 usbhost1 usbhost2 usbhost3 still not working?? dmesg? Yeah, OTG port is usbhost0, but there is a power switch controlled by PL2, it is not enabled. martinayotte said he will release a patch.
kutysam Posted August 4, 2017 Posted August 4, 2017 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.
mantouboji Posted August 4, 2017 Author Posted August 4, 2017 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
martinayotte Posted August 4, 2017 Posted August 4, 2017 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...
zador.blood.stained Posted August 4, 2017 Posted August 4, 2017 6 minutes ago, martinayotte said: I will need to sacrifice a Micro cable and solder a female connector on it... The OTG connector also requires the ID pin pulled to the ground for the host mode. It may be easier to pull existing patches like this from linux-next or wait until we start switching to 4.13.
martinayotte Posted August 4, 2017 Posted August 4, 2017 I've sacrificed a Micro cable and discovered that the ID pin is not wired ! :-( I'll have to wait the real adaptor purchased on eBay ...
kutysam Posted August 5, 2017 Posted August 5, 2017 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
martinayotte Posted August 18, 2017 Posted August 18, 2017 I've added the patch for PL2 controls : https://github.com/armbian/build/commit/fb0d3c6ea4b06df236d198af825d31a073dd2b81
mantouboji Posted August 23, 2017 Author Posted August 23, 2017 On 2017/8/19 at 3:43 AM, martinayotte said: I've added the patch for PL2 controls : https://github.com/armbian/build/commit/fb0d3c6ea4b06df236d198af825d31a073dd2b81 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
kutysam Posted August 23, 2017 Posted August 23, 2017 Still having [ 41.518342] musb_bus_suspend 2584: trying to suspend as a_wait_bcon while active
martinayotte Posted August 26, 2017 Posted August 26, 2017 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 ?
mantouboji Posted August 29, 2017 Author Posted August 29, 2017 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
martinayotte Posted August 29, 2017 Posted August 29, 2017 As I mentioned, you need to tweak DT by changing the "dr-mode" to "host" since it is defaulted to "otg" for usb-gadget.
mantouboji Posted August 29, 2017 Author Posted August 29, 2017 17 minutes ago, martinayotte said: As I mentioned, you need to tweak DT by changing the "dr-mode" to "host" since it is defaulted to "otg" for usb-gadget. May I edit it on-the-fly without rebuild anything?
martinayotte Posted August 29, 2017 Posted August 29, 2017 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 ...
mantouboji Posted September 1, 2017 Author Posted September 1, 2017 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!
zsix Posted November 10, 2017 Posted November 10, 2017 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
surenz Posted November 28, 2017 Posted November 28, 2017 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"? 4
Igor Posted November 28, 2017 Posted November 28, 2017 This OTG <> HOST switcher is planned for some time to find a place in armbian-config. It exists only as a 2do list entry for now
zador.blood.stained Posted November 29, 2017 Posted November 29, 2017 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.
technik007_cz Posted February 6, 2018 Posted February 6, 2018 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.
diaamant Posted July 13, 2018 Posted July 13, 2018 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>; };
Aldolo Posted September 7, 2018 Posted September 7, 2018 Interesting thread. Now i know why my arduino does not work as expected in the otg port. In the and the port can be used as host, talking to mouse and memory stick, or as otg, talking to a pc, but not both.
BarnA Posted October 30, 2018 Posted October 30, 2018 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?
Mintytail Posted May 24, 2019 Posted May 24, 2019 (edited) 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 May 24, 2019 by Mintytail script update: remove temporary files
Recommended Posts