Jump to content

Fionn

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by Fionn

  1. I'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!
  2. GOT IT!!!!!! Okay so reading this forum gave me the idea: The GPIO's under the control of the USB0-vbus which was blocking me from making any changes were listed in the dtb under: A USB has 4 connections: "5v", "Data -", "data +", "ground" As we know that PL2 (aka 354) is the power provided the gpio's listed above are in the same order the 1st one much be PL2. So I changed gpio = < 0x3b 0x00 0x02 0x00 >; to gpio = < 0x00 0x02 0x00 >; and then recompiled (use armbian-config >system >dtc to modify the dtb, it makes like 100x easier). Now by default the USB-OTG is off and using "lsusb" shows no device, but when i run: echo "354" | sudo tee /sys/class/gpio/export echo "out" | sudo tee /sys/class/gpio/gpio354/direction echo "1" | sudo tee /sys/class/gpio/gpio354/value It turns on! and I can turn it off again by running: echo "0" | sudo tee /sys/class/gpio/gpio354/value I'm delighted and this is working really well without any issues. The only thing I would like to do is to change the access so it doesn't require sudo to run the gpio commands if anyone knows how to do that please let me know. Alternatively I would love to use wiringOP to control the usb-otg but I'm not sure if it can, I might give it a try anyway.
  3. Digging a little bit more I've found this patch which was done to allow you to control pin PL2: https://github.com/armbian/build/commit/fb0d3c6ea4b06df236d198af825d31a073dd2b81 it seems to be for the orangepi PC but I assume there is a similar functionality for the orange pi one. or if not how could it be created? secondly I've found this: https://github.com/ARM-software/u-boot/blob/master/arch/arm/dts/sun8i-h3-orangepi-one.dts which contains I could be wrong but I believe this is sets PL2 high. on the equivalent dts file on my computer I don't have that exact line however I do have: Which I suspect is the same thing, just in a different version, I am going to try and play around with this to see if it can be changed. What I'm unsure of is the second link above uses several includes at the start: Which I believe allows the user to write <&r_pio 0 2 GPIO_ACTIVE_HIGH> but I'm unsure. If anyone has any experience in these it would be hugely appreciated, are there any resources for learning this type of thing? Very much new to this whole space.
  4. Okay so I've made some progress but have hit a wall. I can access the gpio pins using sysfm, I was having a lot of permission issues due to the ">" symbol in the standard commands, e.g echo 354 > /sys/class/gpio/export To excecute these commands I had to rewrite them as: echo "354" | sudo tee /sys/class/gpio/export or sudo sh -c 'echo "354" > /sys/class/gpio/export' The issue I am having now is that I cannot export or control gpio-354 (PL2) in order to turn on and off the usb-otg port. Anytime I attempt to I get the error I can confirm this to be true as after running sudo cat /sys/kernel/debug/gpio I get My issue is that I do not know how override that control. I have changed the device tree (dtb) files multiple times changing the dr_mode from "otg" to "host" . Doing this successfully changes the gpio-354 output from lo to hi but I cannot change it without recompiling. 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 >; }; phy@1c19400 { compatible = "allwinner,sun8i-h3-usb-phy"; reg = < 0x1c19400 0x2c 0x1c1a800 0x04 0x1c1b800 0x04 0x1c$ reg-names = "phy_ctrl\0pmu0\0pmu1\0pmu2\0pmu3"; clocks = < 0x03 0x58 0x03 0x59 0x03 0x5a 0x03 0x5b >; clock-names = "usb0_phy\0usb1_phy\0usb2_phy\0usb3_phy"; resets = < 0x03 0x00 0x03 0x01 0x03 0x02 0x03 0x03 >; reset-names = "usb0_reset\0usb1_reset\0usb2_reset\0usb3_r$ status = "okay"; #phy-cells = < 0x01 >; usb0_id_det-gpios = < 0x0c 0x06 0x0c 0x00 >; usb0_vbus-supply = < 0x0f >; phandle = < 0x0e >; };
  5. Hi all, I am hoping there is a straight forward solution to this; I've read this thread on turning on and off the usb OTG using GPIO commands: The concept is really clever and I was hoping to use it as part of my Octoprint 3D printing setup so that I can turn off printer when not in use. The only catch is that the method requires modifying the ./bin/orangepione.bin file which isn't present on my version of Armbian (Buster). TL;DR according to the post I need to 1. convert ./bin/orangepione.bin to FEX, 2. edit the file by adding "usb_drv_vbus_gpio = port:PL02<1><0><default><0>", 3. convert it back to bin, 4. use the commands "echo 0 > /sys/class/gpio/gpio354/value" or "echo 1 > /sys/class/gpio/gpio354/value" to turn off/on the pin and thus usb. Is there an equivalent file where I could modify the line "usb_drv_vbus_gpio =" which would allow me to control pin PL2? Alternatively is it possible to control pin PL2 using the WiringOP? I am currently using it to control a relay however while looking into it I could not find any reference to PL2. I'm fairly new to Linux and Armbian so any guidance at all would be very much appreciated.
  6. Thank you for the suggestion! Out of frustration I flashed the sd and installed a fresh version of armbian buster and was able to get the .bashrc file to run without any issues. The only thing is the video which is being streamed with the program isn't running as well as it was before so perhaps there was something installed relating to vlc which caused the initial issue. I am going to attempt to use the systemd method you mentioned, as I cannot seem to get the video working smoothly on the new installation.
  7. Thanks for the help, I tried this but no luck. I also tried booting as root using mkdir -p /etc/systemd/system/getty@tty1.service.d cat << _EOF_ > /etc/systemd/system/getty@tty1.service.d/autologin.conf [Service] ExecStart= ExecStart=-/sbin/agetty --autologin root %I _EOF_ systemctl daemon-reload which I found here: Unfortunatly I'm still having the same problem, I have also tried without autologin but the same issue, the bashrc script runs but only from ssh. This is making me think that the issue is to do with the way I've setup .bashrc. Perhaps someone verify that this is correct: To set up a program to run on login using .bashrc you; 1. login to the user which will be running the script. In this case I'll refer to it as "example_user". 2. enter the .bashrc file by entering: "sudo nano /home/example_user/.bashrc" 3. to run the script go to the end of the file and enter the program you wish to run. In this case "python3 /path_to_file/example_file.py" << In my case sudo isn't needed to run the file. The end of the resulting file should then look like: " # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi echo Running tv streaming program from boot python3 /path_to_file/example.py "
  8. I went to the folder: /lib/systemd/system/getty@tty1.service.d/ the created a file: 20-autologin.conf after which I wrote: [Service] ExecStart= ExecStart=-/sbin/agetty --autologin user --noclear %I $TERM where user is the name of the profile which is logging in
  9. Yes the text console, I haven't installed the desktop.
  10. Hi, I am having a strange problem with my Orangepi One, I previously had a python script which was run on login using .bashrc. The python script controlled VLC using the python bindings and hence I could not use crontab -e or rc.local as they are run in the backgound. Previously .bashrc worked without any issues however either I updated VLC or armbian and now it does not run after I login (even using an autologin). Strangely enough however if I login via SSH the script runs. To access it I use : sudo nano /home/user/.bashrc To run the script I append to the end of the file without making any adjustments: echo Running tv streaming program from boot python3 /home/user/path_to_file/pyVLC.py It seems strange as the program runs successfully when I login with SSH, which makes me think that maybe I need to specify that it runs in normal start-up or that perhaps there is something running before it that blocks it (maybe the armbian logo as it is not present in the ssh boot?). I have reloaded the OS to see if I accidentally changed a setting however the same problem is occurring. The only changes that are made from the fresh boot were installing: python3 cython chromium chromedriver and enabling SSH from armbian-monitor I am unsure how to proceed and any assistance would be greatly appreciated. Best regards,
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines