Jump to content

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


mdrmdr

Recommended Posts

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
Link to comment
Share on other sites

Moved post to correct forum.  Your board isn't supported by Armbian, but you were posting in the supported boards section, that is why you couldn't apply the correct board tag.

Moved to community maintained/ unsupported 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines