Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

NanoPi Neo V1.4 1801 / enable Micro-USB port as USB-host

Featured Replies

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...

 

NanoPi_Neo_Power.jpg

Edited by mdrmdr

Solved by Gunjan Gupta

  • Author

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.

 

Edited by mdrmdr

  • Solution

Nice work. though this might all get overwritten on next upgrade. Hence I will suggest you to convert those dtb changes into a device tree overlay.

These might help you with the same

- https://bootlin.com/blog/using-device-tree-overlays-example-on-beaglebone-boards/

- https://docs.armbian.com/User-Guide_Allwinner_overlays/#using-custom-overlays

  • Author

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.

Edited by mdrmdr

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.