OTG on Rock Pi E

I am trying to enable g_ether on the USB OTG port, but I am not able to see the RNDIS device come up on my Mac.

I connected Data-, Data+ and GND to the respective pins 16, 18 and 20 on the 40-pin header.

Do I need to enable any particular Device Tree overlay to enable OTG?
https://wiki.radxa.com/Device-tree-overlays

dmesg
https://www.icloud.com/iclouddrive/0QOX-7om033cXR6DqtewrB2yg#dmesg

/var/log/messages

Those will probably not work OOB on a modern (armbian) kernel. If they were developed/ported, you can see this in armbian-config -> hardware … otherwise you need to poke DT manually to try to enable this.

Thank you @igorp, I know you are a busy man and appreciate your help.

armbian-config -> system -> hardware does not offer any OTG option:

@radxa, @jack, @hipboi, any suggestions on how to enable OTG on Rock Pi E running Armbian 20.11.0 kernel 5.8.10, please?

https://www.armbian.com/donate
We will anyway make it one day, like we made those.

what about the 5V power source?

I tried connecting 5V to the header and the Pi powered on, but OTG did not work.

Also, I tried powering the Pi using its USB-C port and it powered on, but I had no luck with the OTG.

SSH to the Pi via eth0 and eth1 worked like a charm.

Jerry from the WLAN Pi team managed to enable OTG on the Rock Pi E running Armbian. Here are his instructions for everyone’s reference:

Convert DTB to DTS

sudo dtc -I dtb /boot/dtb/rockchip/rk3328-rock-pi-e.dtb -O dts -o /boot/dtb/rockchip/rk3328-rock-pi-e.dts

Modify rk3328-rock-pi-e.dts

sudo nano /boot/dtb/rockchip/rk3328-rock-pi-e.dts

Locate section usb@ff580000

    usb@ff580000 {
            compatible = "rockchip,rk3328-usb\0rockchip,rk3066-usb\0snps,dwc2";
            reg = < 0x00 0xff580000 0x00 0x40000 >;
            interrupts = < 0x00 0x17 0x04 >;
            clocks = < 0x02 0x14d >;
            clock-names = "otg";
            dr_mode = "host";
            g-np-tx-fifo-size = < 0x10 >;
            g-rx-fifo-size = < 0x118 >;
            g-tx-fifo-size = < 0x100 0x80 0x80 0x40 0x20 0x10 >;
            phys = < 0x5a >;
            phy-names = "usb2-phy";
            status = "okay";
            phandle = < 0x9d >;
    };

Modify dr_mode

Change
dr_mode = “host”;
To
dr_mode = “otg”;

Convert DTS file back to DTB format

sudo dtc -I dts /boot/dtb/rockchip/rk3328-rock-pi-e.dts -O dtb -o /boot/dtb/rockchip/rk3328-rock-pi-e-rev01.dtb

Add DTB to armbianEnv.txt

sudo nano /boot/armbianEnv.txt

Add the following line

fdtfile=rockchip/rk3328-rock-pi-e-rev01.dtb

Should look like this - armbianEnv.txt

verbosity=1
bootlogo=false
overlay_prefix=rockchip
rootdev=UUID=8a77dff9-013f-4a2f-8c9b-4e2c0afb076d
rootfstype=ext4
console=serial
overlays=i2c7 i2c8
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
fdtfile=rockchip/rk3328-rock-pi-e-rev01.dtb

Add g_ether module

sudo nano /etc/modules

Add the following to /etc/modules

g_ether

Reboot and OTG should be working!

Cc: @igorp

3 Likes

I can confirm it works perfectly, thanks for the clear instructions!

As already mentioned, the procedure works like a charm to enable virtual ethernet over usb, but I’m struggling with following items:

  • set a fixed IP address for the usb0 network device under armbian, if I use armbian-config it works but the setting is lost on reboot

  • when I set a fixed ip address, the wifi connection is still active, but it’s not used for connecting to internet anymore. I would like to have the ethernet over usb working, but keeping the connection to internet through wifi

Hi, anyone can help me troubleshoot?
I have followed the steps above on the debian buster.

lsusb (with or without being connected) gives me:
rock@rockpie:~$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 0bda:d723 Realtek Semiconductor Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Then dmesg returns me:
rock@rockpie:~$ dmesg | grep OTG
[ 4.112804] dwc2 ff580000.usb: DWC OTG Controller
[ 4.131223] usb usb5: Product: DWC OTG Controller

rock@rockpie:~$ dmesg | grep g_ether
[ 7.382299] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[ 7.387515] g_ether gadget: g_ether ready
[ 7.395674] dwc2 ff580000.usb: bound driver g_ether
[ 222.307257] g_ether gadget: high-speed config #2: RNDIS
[ 222.954049] g_ether gadget: high-speed config #2: RNDIS
[ 637.558908] g_ether gadget: high-speed config #2: RNDIS

I connected the D-, D+ and GND on the 16, 18 and 20 GPIO.

Can anyone help?

Would this work on the rock-pi-4b too? I cant seem to find the section “usb@ff580000”.

Hi,

After asking they put the “clean” procedure within the development section of the RockPi E, there:
https://wiki.radxa.com/RockpiE/dev/usb-mass-storage

I would open one for the rock pi 4 as well, because this way is really neat.

Armandooooo

ROCK Pi 4 usb network: https://wiki.radxa.com/Rockpi4/dev/usbnet

ROCK Pi 4 adb: https://wiki.radxa.com/Rockpi4/dev/adb