Rpi 4 Ethernet Hat via GPIO

Hello Everybody,
So i am running into an Issue that i hope someone can help me solve. i am using an RPi4 B with the newest build of Openwrt, i bought an Ethernet Hat via Amazon (https://www.waveshare.com/product/raspberry-pi/hats/eth-usb-hub-hat.htm), its made by wave share, The Hat is using a RTL8152B Ethernet chip, after locating the appropriate Drive (at least from what i read they are correct), after a few tries, including running the usb cable from the pi to the hat, i still cannot get the ethernet port to work, if i plug my laptop into that port i cannot connect to the pi, but i am able to connect via the built on RJ45 port on the pi directly, i know the hat is working because it shows up in the devices during boot as a usb-ethernet adapter, i was able to get raspbian os to briefly regester the hat so i know the hat is not bad. not sure of what i am missing to get this to work via the GPIO. any help and or suggestions would be appreciated

And you installed the appropriate kernel module package?

What do lsmod, lsusb and friends say?

that was the first package i installed after using the rpi wifi to connect to the package store. there was a few others related to that that i also installed.

this is from "lsmod" 
root@OpenWrt:~# lsmod
brcmfmac              258048  0
brcmutil               12288  1 brcmfmac
cfg80211              335872  1 brcmfmac
compat                 12288  2 brcmfmac,cfg80211
crc_ccitt              12288  1 ppp_async
evdev                  28672  0
fat                    73728  1 vfat
hid                   114688  2 usbhid,hid_generic
hid_generic            12288  0
ip_tables              24576  4 iptable_nat,iptable_mangle,iptable_filter
ip6_tables             20480 24 ip6table_mangle,ip6table_filter
ip6t_REJECT            12288  2
ip6table_filter        12288  1
ip6table_mangle        12288  0
ipt_REJECT             12288  2
iptable_filter         12288  1
iptable_mangle         12288  0
iptable_nat            12288  1
nf_conntrack           90112  8 xt_state,xt_nat,xt_conntrack,xt_REDIRECT,xt_MASQUERADE,xt_CT,nf_nat,nf_flow_table
nf_defrag_ipv4         12288  1 nf_conntrack
nf_defrag_ipv6         12288  1 nf_conntrack
nf_flow_table          20480  2 xt_FLOWOFFLOAD,nf_flow_table_hw
nf_flow_table_hw       12288  1
nf_log_common          12288  2 nf_log_ipv4,nf_log_ipv6
nf_log_ipv4            12288  0
nf_log_ipv6            12288  0
nf_nat                 36864  4 iptable_nat,xt_nat,xt_REDIRECT,xt_MASQUERADE
nf_reject_ipv4         12288  1 ipt_REJECT
nf_reject_ipv6         12288  1 ip6t_REJECT
nls_cp437              16384  1
nls_iso8859_1          12288  1
nls_utf8               12288  0
ppp_async              20480  0
ppp_generic            40960  3 pppoe,ppp_async,pppox
pppoe                  20480  0
pppox                  12288  1 pppoe
slhc                   12288  1 ppp_generic
snd                    73728  9 snd_bcm2835,snd_rawmidi,snd_seq_device,snd_pcm_oss,snd_pcm,snd_timer,snd_mixer_oss,snd_hwdep,snd_compress
snd_bcm2835            20480  0
snd_compress           20480  0
snd_hwdep              16384  0
snd_mixer_oss          28672  1 snd_pcm_oss
snd_pcm                90112  3 snd_bcm2835,snd_pcm_oss,snd_pcm_dmaengine
snd_pcm_dmaengine      12288  0
snd_pcm_oss            53248  0
snd_rawmidi            40960  0
snd_seq_device         12288  1 snd_rawmidi
snd_timer              32768  1 snd_pcm
soundcore              12288  1 snd
usbhid                 40960  0
vfat                   16384  1
x_tables               28672 24 xt_state,xt_nat,xt_conntrack,xt_REDIRECT,xt_MASQUERADE,xt_FLOWOFFLOAD,xt_CT,ipt_REJECT,xt_time,xt_tcpudp,xt_multiport,xt_mark,xt_mac,xt_limit,xt_comment,xt_TCPMSS,xt_LOG,iptable_mangle,iptable_filter,ip_tables,ip6table_mangle,ip6table_filter,ip6_tables,ip6t_REJECT
xt_CT                  12288  0
xt_FLOWOFFLOAD         12288  0
xt_LOG                 12288  0
xt_MASQUERADE          12288  1
xt_REDIRECT            12288  0
xt_TCPMSS              12288  0
xt_comment             12288107
xt_conntrack           12288 12
xt_limit               12288 20
xt_mac                 12288  0
xt_mark                12288  0
xt_multiport           12288  0
xt_nat                 12288  0
xt_state               12288  0
xt_tcpudp              12288  8
xt_time                12288  0

when i went to run lsusb it came back as command not found

Is this a usb device or GPIO / SPI? If it's an SPI device you would need to tell the PI in it's config file to enable to SPI points on the GPIO header.

If it's usb, what is it connecting to the gpio for at all, passthrough and power? Does it work if you just connect it as a usb ethernet to a pc?

It is a GPIO attachment for the GPIO header on the RPi 4. how do i enable that with openwrt installed??

That device appears to be simply a Pi-hat type form factor version of a USB hub with Ethernet. From the look of the hat, it appears that you must connect it via USB to the Pi (using a USB A to USB micro-B cable. I am reasonably certain that the hat doesn't do much (if anything at all) based on the connectivity through the 40-pin header... maybe it gets some power from that header. I don't think that any of the pins on that header can support the speeds required for USB 2.0 and 10/100 ethernet. USB doesn't exist on the 40-pin header, and the RTL8152B is a USB-Ethernet chip, so it needs to get USB from somewhere -- that is why it has the micro-B connector.


it did come with a usb A to micro usb cable, i have plugged it into the pi and the hat board, and i cannot make a connection via the ethernet hat via my laptop or from my switch. it is detected, just cannot get an internet connection or connect from my laptop, i dont mind running the cable if i need to but i do want the use the 2nd RJ45 port..

Run ip link show to confirm that you have two Ethernet ports. The built in port will be eth0 and the extra one eth1. Having an eth1 means that the kernel driver started up the port. The startup and assignment of eth1 will also be in the kernel log-- it will do it once during boot and again if you were to unplug and replug the USB cable. As others said, that chip must have a USB connection in order to work, and since there are no USB signals on the 40 pin header, a separate cable is needed.

Next you would need to actually put eth1 into a network so that it has a path to the kernel networking. The first thing to try would be to add it to br-lan.

Since you have a Pi 4, a USB3 to GbE adapter would work, with the potential for 10x the speed.

Yeah, sorry. For that to work one needs installing them usbutils first.

Yes, it's just a USB to Ethernet dongle on a fancy RPi hat. That's why I asked him to install resp. modules and look at lsusb as well.

1 Like

Yes, you absolutely need to connect the micro USB of that hat to the regular USB port of your RPi for the USB Ethernet functionality to work. There is absolutely no easy around that.

i will mess with all of this tonight and add an update tomorrow. i appreciate the help from everyone.

That would be the next step once the USB connectivity is confirmed. So far, as long as not even the resp. kernel module gets loaded it will definitely not show up there.

i was attempting to get everything confirmed, and my microsd card died, flashed new copy to a different sd card and after going from my laptop to the rpi4 and connecting to wifi, no luck on connecting to the software store. i shut it off, disconnected the usb cable to the hat then completely removed the pi hat off of the board restart and still no internet connection. tried a few different combos of setting a static ip, no dhcp, turning of firewall, bridging the lan and wifi making sure both were enabled, still no joy on connecting to the store.

What store are you trying to connect to?

What does the dmesg say about network interfaces?

was trying to get to the software package store for openwrt so i can install drivers.
after a fresh install, keeping off the wi-fi connection, reboot i was finally able to install the kmos-usb-rltk8152 driver, i removed the hat from the gpio (for now) and i have two seperate ip addresses, my "lsmod, lsusb, ip link show" are all displaying both an up status, and ip addresses, and it seem that everything is now working, gonna run it for a few more days to make sure but everyone here is super awesome and thank you for the help- more updates to follow..

THANK YOU EVERYONE!! all awesome.