Fionn
Members
-
Joined
-
Last visited
Solutions
-
Fionn's post in Control USB-OTG Power On/Off On Orange Pi One - Armbian Buster was marked as the answerI'll give the TL;DR version:
1. sudo apt update && sudo apt upgrade
2. sudo armbian-config
3. Scroll to "system" then "Dtc" (as per attached image)
4. search for: "usb@1c19000" (use ctrl+w for speed)
5. change dr_mode to "host and status to "okay" as below
usb@1c19000 { compatible = "allwinner,sun8i-h3-musb"; reg = < 0x1c19000 0x400 >; clocks = < 0x03 0x20 >; resets = < 0x03 0x11 >; interrupts = < 0x00 0x47 0x04 >; interrupt-names = "mc"; phys = < 0x0e 0x00 >; phy-names = "usb"; extcon = < 0x0e 0x00 >; dr_mode = "host"; status = "okay"; phandle = < 0x47 >; }; 6. search for "usb0-vbus"
7. Change gpio to < 0x00 0x02 0x00 >; as below
usb0-vbus { compatible = "regulator-fixed"; regulator-name = "usb0-vbus"; regulator-min-microvolt = < 0x4c4b40 >; regulator-max-microvolt = < 0x4c4b40 >; enable-active-high; gpio = < 0x00 0x02 0x00 >; status = "okay"; phandle = < 0x0f >; }; 8. Save, exit and recompile
9. run lsusb and the otg device will not be listed
10. echo "354" | sudo tee /sys/class/gpio/export #makes pin PL2 controllable
11. echo "out" | sudo tee /sys/class/gpio/gpio354/direction #sets pin as an output
12. echo "1" | sudo tee /sys/class/gpio/gpio354/value #turns on the usb
13. run lsusb and otg device should be listed .
14. echo "0" | sudo tee /sys/class/gpio/gpio354/value #turns off the usb
15. you will need to run steps 10 and 11 each time the OPi one boots.
And there you have it!