Jump to content

mdrmdr

Members
  • Posts

    40
  • Joined

  • Last visited

Recent Profile Visitors

1260 profile views
  1. May be a small step: This is the overlay I use on both, H3 and H5 systems: /dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h3", "allwinner,sun50i-h5"; fragment@0 { target-path = "/"; __overlay__ { soc { usb@1c19000 { dr_mode = "host"; }; }; usb0-vbus { #status = "okay"; status = "disabled"; }; }; }; }; For H3, I have set status for usb0-vbus to okay, for H5 to disabled. If its okay for the H5, power is on after boot, device (SD card) is usable (see below) but I cannot control power. Now, when disabled, I see following on the H5 system: The proper GPIO 354 file is seen in /sys/class/gpio/. I know that this is the old legacy way of controlling GPIO's on the new kernels. But it works perfectly well on the H3 with the same kernel revision, just 32 bit instead of 64 bit on the H5 I can export it and then echo 1 or 0 to it which actually toggles power (can see that on the blue light of the micro SD adapter for the micro USB port) But, usb0-vbus=disabled seems to disable the whole system USB, as for example lsusb shows nothing anymore and therefore lsblk does not show the device So, nice try, but not successful. I'll continue research the next days. The good thing is, that the H5 is a pure test device 😉
  2. Thanks for the information and the links. I'll dive into it the next days... Yes, the part in the board schematics which controls the chip to power the OTG micro USB port is 100% identical between a NanoPi Neo and a NanoPi Neo2. Same GPIO pin on the SOC. The strange thing is, that the used Kernel would support to enable the sysfs "export" of a GPIO number from userspace: $ zcat /proc/config.gz | grep CONFIG_GPIO_SYSFS CONFIG_GPIO_SYSFS=y I analyzed further the diffs of the device trees and found below (excerpt again) line marked with ** **, which is not in the H3 device tree. The usb0-vbus def is in the H3 tree as well, but not referenced. Tomorrow I'll create an overlay which sets the status of usb0-vbus to "disabled" (as I just read that delete does not exist). Maybe it works 🙃 phy@1c19400 { ** usb0_vbus-supply = <0x19>; ** usb0-vbus { phandle = <0x19>;
  3. Hi, I'm using Armbian 24.11.1 bookworm with a V6.6.62 64 bit Kernel on a NanoPi Neo2. To debug, I have a UART/Serial-to-USB connector attached. Other end is on a Windows 11 box where I use Putty. The setup works fine with one minor issue. During the print of the boot messages, suddenly the printed line width of lines with [ <status> ] is limited 70 columns. It starts shortly after the Welcome to Armbian 24.11.1 bookworm! message and a "…" character is used to shorten the lines. This part has normal line length: Welcome to Armbian 24.11.1 bookworm! [ 4.922261] systemd[1]: Hostname set to <nanopineo>. [ 5.680204] systemd[1]: Binding to IPv6 address not available since kernel does not support IPv6. [ 5.689209] systemd[1]: Binding to IPv6 address not available since kernel does not support IPv6. [ 6.078395] systemd[1]: Queued start job for default target graphical.target. [ 6.107963] systemd[1]: Created slice system-getty.slice - Slice /system/getty. [ OK ] Created slice system-getty.slice - Slice /system/getty. [ 6.137033] systemd[1]: Created slice system-modprobe.slice - Slice /system/modprobe. From the next output line on, most lines with [ OK ] are shortened with "…": [ OK ] Created slice system-modpr…lice - Slice /system/modprobe. [ 6.165124] systemd[1]: Created slice system-serial\x2dgetty.slice - Slice /system/serial-getty. [ OK ] Created slice system-seria… - Slice /system/serial-getty. [ 6.191931] systemd[1]: Created slice user.slice - User and Session Slice. [ OK ] Created slice user.slice - User and Session Slice. [ 6.218740] systemd[1]: Started systemd-ask-password-console.path - Dispatch Password Requests to Console Directory Watch. [ OK ] Started systemd-ask-passwo…quests to Console Directory Watch. What setting avoids this and allows the print of the full line with line wrap if too long? I'd be already happy it it would be the same behavior as after login, where the line width as defined in Putty (120 characters) is used. Is this just a general limitation of a UART console?
  4. One possible essential difference from cat /sys/kernel/debug/gpio is this: From NanoPi Neo (H3/32bit) gpiochip1: GPIOs 352-383, parent: platform/1f02c00.pinctrl, 1f02c00.pinctrl: gpio-354 ( |sysfs ) out hi gpio-355 ( |k1 ) in hi IRQ ACTIVE LOW gpio-358 ( |vdd-cpux ) out lo From NanoPi Neo2 (H5/64bit) gpiochip0: GPIOs 352-383, parent: platform/1f02c00.pinctrl, 1f02c00.pinctrl: gpio-354 ( |usb0-vbus ) out hi gpio-358 ( |vdd-cpux ) out lo gpio-362 ( |nanopi:red:pwr ) out hi I think this shows that indeed on the H5, GPIO 354 is occupied by a driver while on the H3 not. Guess this is the reason, that on the H3 echo to /sys/class/gpio/gpio354/value is possible and on H5 not. Who knows how to revert the (default) setting from driver to "sysfs"?
  5. The relevant device tree parts are more or less equal: From NanoPi Neo (H3/32bit) usb_otg = "/soc/usb@1c19000"; usb@1c19000 { clocks = <0x03 0x20>; compatible = "allwinner,sun8i-h3-musb"; dr_mode = "host"; extcon = <0x19 0x00>; interrupt-names = "mc"; interrupts = <0x00 0x47 0x04>; phandle = <0x54>; phy-names = "usb"; phys = <0x19 0x00>; reg = <0x1c19000 0x400>; resets = <0x03 0x11>; status = "okay"; }; usb0-vbus { compatible = "regulator-fixed"; enable-active-high; gpio = <0x15 0x01 0x09 0x00>; phandle = <0x89>; regulator-max-microvolt = <0x4c4b40>; regulator-min-microvolt = <0x4c4b40>; regulator-name = "usb0-vbus"; status = "okay"; }; From NanoPi Neo2 (H5/64bit) usb_otg = "/soc/usb@1c19000"; usb@1c19000 { clocks = <0x03 0x20>; compatible = "allwinner,sun8i-h3-musb"; dr_mode = "host"; extcon = <0x18 0x00>; interrupt-names = "mc"; interrupts = <0x00 0x47 0x04>; phandle = <0x52>; phy-names = "usb"; phys = <0x18 0x00>; reg = <0x1c19000 0x400>; resets = <0x03 0x11>; status = "okay"; }; usb0-vbus { compatible = "regulator-fixed"; enable-active-high; gpio = <0x42 0x00 0x02 0x00>; phandle = <0x19>; regulator-max-microvolt = <0x4c4b40>; regulator-min-microvolt = <0x4c4b40>; regulator-name = "usb0-vbus"; status = "okay"; }; Also the "modern" way of setting the relevant GPIO fails: $ gpiodetect gpiochip0 [1f02c00.pinctrl] (32 lines) gpiochip1 [1c20800.pinctrl] (224 lines) $ gpioinfo gpiochip0 |head -4 gpiochip0 - 32 lines: line 0: unnamed unused input active-high line 1: unnamed unused input active-high line 2: unnamed "usb0-vbus" output active-high [used] $ gpioset --mode=wait 1f02c00.pinctrl 2=0 gpioset: error setting the GPIO line values: Device or resource busy Somewhere I read, that possibly a driver grabbed the GPIO and therefore its locked. How do I find the driver? It might be a solution to black-list it in /etc/modprobe.d/blacklist-nanopineo.conf
  6. Therefore I wrote "excerpt" in my post. The used dts of course has all required parts and compiles fine... I'll do tonight. Thanks for the idea,
  7. Hi, i could control the OTG micro USB port power on my NanoPi Neo (H3) by exporting and writing to GPIO 354 (line 2 of GPIO chip with base 352) I'm using Kernel V6.6.62 and I created a tiny device tree overlay defining. Excerpt below: usb@1c19000 { dr_mode = "host" } usb0-vbus { status = "okay" } This works fine! For test purposes, I switched to a NanoPi Neo2 (H5) with Kernel 6.6.62 (64 bit). Here, the OTG port is powered on and is usable by default without any overlay. But the on/off control does not work anymore. All attempts to export GPIO 354 give "write error: Device or resource busy". Schematics show no circuit difference in controlling the OTG power. In both cases its the same pin name on H3 and H5. The new GPIO handling of newer kernels cannot be the reason, as I use the same kernel versions on H3 and H5 (beside bit width). Any idea whats wrong and how I can again switch on/off OTG power?
  8. Why is it always the case that after asking for help, you keep looking and then you find the solution? 😉 The SD boots using the instructions on this page: https://docs.armbian.com/User-Guide_Recovery/#flashing-boot-loader In my case using this U-Boot files: https://mirrors.dotsrc.org/armbian-apt/pool/main/l/linux-u-boot-nanopineo-current/ Maybe this helps someone having the same issue. Update question: Maybe one can answer that: I did use u-boot-sunxi-with-spl.bin from the above URL, which works perfectly well. Why does the same file from https://ftp.de.debian.org/debian/dists/bullseye/main/installer-armhf/current/images/u-boot/NanoPiNeo/ not work? With the one from the Debian site, the NanoPi does not boot. To write I use: dd if=u-boot-sunxi-with-spl.bin of=/dev/sda bs=8k seek=1 Update 2: Guess I found my error. The Debian U-Boot file is just not made for an NanoPi Neo running Armbian. I'm now using the one which comes with the installation, which is /usr/lib/linux-u-boot-current-nanopineo/u-boot-sunxi-with-spl.bin. This works fine.
  9. I have a NanoPi Neo V1.4 running Armbian 23.8.1 bullseye with kernel nanopineo 6.1.63-current-sunxi. Now, that I got my micro-USB port working for a SD card holder, I want to programmatically backup my boot SD on a regular base to another SD. Yes, it works by a full dd-copy. but this is quite time consuming and I want to skip some directories while backup, which does not work with dd. The idea: Take a new SD (same model as source SD) Create a new partition table and a primary partition 1 with fully equal parameters as my source SD Format partition 1 with ext4 and mount to /mnt rsync all files (exclude some directories as e.g. /var/log) from source / to target / (which is /mnt/) Use this SD in case of a problem with the source SD as new boot SD In /boot/armbianEnv.txt i have rootdev=/dev/mmcblk0p1. No UUID used. But, it just does not boot. The LED's of my NanoPi stay on with no blinking at all. Nothing is written to /var/log. Unfortunately I cannot connect a console to the NanoPi to see the boot messages. Only SSH at this time. What is missing on the new SD? I assume something with the U-Boot bootloader? Can anybody help me? What is missing and needs to be copied to the SD? I assume to the bytes 512-8192 just in front of partition 1 and after the partition table. Even that a full dd works, I'd like to know how to do that manually. Thanks a lot for help 🙂
  10. Using a device tree overlay works well 👍 But with dr_mode="otg", I still need the GPIO commands to activate the micro-USB port for an USB-stick I think this would work if I'd connect a host. But for a peripheral as an USB-stick, I first need to apply the 5V, which is, according the schematics, done with GPIO PL2. And, opened an issue for the armbian-config problem I had: https://github.com/armbian/config/issues/214 Anyway, thanks a lot for your tips. I'm happy that I can now use an USB device to backup my live system/boot SD card from the NanoPi Neo without removing it.
  11. Thanks 🙂 will try both suggestions tomorrow
  12. Success 🙂 I could connect an USB stick now to the micro-USB port on my NanoPi Neo and read/write to it. I'm now on Armbian 23.8.1 bullseye with kernel 6.1.63-current-sunxi as my productive NanoPi Neo runs a HomeGear Gateway, which only works up to bullseye. Just 3 small changes in the device tree file sun8i-h3-nanopi-neo.dtb and armbianEnv.txt were required (just changes are shown): usb@1c19000 { #dr_mode = "peripheral"; dr_mode = "host"; }; usb0-vbus { #status = "disabled"; status = "okay"; }; Nano$ cat armbianEnv.txt overlays=spi-spidev usbhost0 usbhost1 usbhost2 param_usb0_mode=0 And on the command line: # make pin PL2 controllable echo "354" | sudo tee /sys/class/gpio/export # set pin as output echo "out" sudo tee /sys/class/gpio/gpio354/direction # turn on micro-usb echo "1" | sudo tee /sys/class/gpio/gpio354/value # turn off mircro-usb echo "0" | sudo tee /sys/class/gpio/gpio354/value I found all this information here. While testing, I found a small issue with armbian-config: If have 2 .dtb files on my system which contain my board name nanopi-neo in the filename: Nano$ ls -1 /boot/dtb/*nanopi-neo* /boot/dtb/sun8i-h3-nanopi-neo-air.dtb /boot/dtb/sun8i-h3-nanopi-neo.dtb The code in /usr/lib/armbian-config/jobs.sh which searches for the proper .dtb file, finds the wrong - first - file. Which is sun8i-h3-nanopi-neo-air.dtb in my case. for dtb in ${dtb_path}/*.dtb do if [[ $dtb == *"${board_name}"* ]]; then used_dtb=$dtb break fi done I modified the if [[ ]]; then line to find the correct file: for dtb in ${dtb_path}/*.dtb do if [[ $dtb == *"${board_name}.dtb" ]]; then used_dtb=$dtb break fi done I'm not sure if the mask *<board name>.dtb can be applied generally, but it works in my case.
  13. I'm powering my NanoPi Neo V1.4 1801 through the USB type A port beside the Ethernet RJ45. I'm using Armbian 23.11.1 bookworm with kernel Linux nanopineo 6.1.63-current-sunxi. Now I want to enable the Micro-USB port (usually used for powering) to act as an USB host so that I can plugin an USB-stick. I found very few instructions for e.g. Orange Pi. There the device tree needs to be changed for usb@1c19000 and usb0-vbus. Also in armbianEnv.txt the line param_usb0_mode=0 should be added. But none of the instructions work for my NanoPi Neo. In the schematics, a SY6280 is connected via GPIOL2/USB0-DRVVBUS to the H3 cpu. This should theoretically allow the NanoPi Neo to apply the 5V internally to the Micro-USB port. But how? Can please anybody post complete instructions how to enable the Micro-USB Port as an fully working USB host port? PS: The tag for this post is wrong, but I could not add another one...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines