ZeroPi with FriendlyWrt and USB Ralink 5370

I know I have a lot going on here, but I feel like my question may be simple.

I have this:
ZeroPi

running FriendlyWrt which uses these repositories:
https://downloads.openwrt.org/releases/19.07.1/packages/arm_cortex-a7_neon-vfpv4/

that I am trying to use as a wifi router with this:
[https://www.amazon.com/gp/product/B00H95C0A2/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1]

I have manually installed the drivers and this is the dmesg output when I unplug and replug the device.

[ 1258.698681] usb 5-1: USB disconnect, device number 3
[ 1275.965906] usb 5-1: new high-speed USB device number 4 using ehci-platform
[ 1276.149082] usb 5-1: New USB device found, idVendor=148f, idProduct=5370
[ 1276.155859] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1276.163055] usb 5-1: Product: 802.11 n WLAN
[ 1276.167296] usb 5-1: Manufacturer: Ralink
[ 1276.171349] usb 5-1: SerialNumber: 1.0

That is the end of dmesg, wifi is not working, no /etc/config/wireless file gets created, no wlan in ifconfig, no radio shows up, no wireless option in luci

When I plug the same device into my RaspberryPi 4 with Raspbian, this is the dmesg output:

[ 68.807979] usb 1-1.1: new high-speed USB device number 4 using xhci_hcd
[ 68.955749] usb 1-1.1: New USB device found, idVendor=148f, idProduct=5370, bcdDevice= 1.01
[ 68.955766] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 68.955779] usb 1-1.1: Product: 802.11 n WLAN
[ 68.955791] usb 1-1.1: Manufacturer: Ralink
[ 68.955803] usb 1-1.1: SerialNumber: 1.0
[ 69.188378] usb 1-1.1: reset high-speed USB device number 4 using xhci_hcd
[ 69.332195] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected
[ 69.353795] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 5370 detected
[ 69.372587] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[ 69.373304] usbcore: registered new interface driver rt2800usb
[ 69.528441] ieee80211 phy1: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[ 69.529894] ieee80211 phy1: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36

My question, how do I force the ZeroPi to do the ieee80211 stuff that the RPi4 did to associate the physical device with wireless?

Thank you!

it looks like you already did

opkg update
opkg install rt2800-usb-firmware kmod-rt2800-usb

also check if you have these installed already?

opkg update
opkg install kmod-cfg80211 kmod-lib80211 kmod-mac80211 wpad-basic

then setup wireless with

wifi config

or

wifi reconf

check it with

wifi status

this should populate /etc/config/wireless

then enable the wifi

uci set wireless.@wifi-device[0].disabled=0; uci commit wireless; wifi

Note2: If your device contains multiple radios (e.g. some dual-band devices), then you'll need to enabled each device in-turn - list disabled devices with

uci show wireless | grep disabled

https://oldwiki.archive.openwrt.org/doc/uci/wireless

Did you solve your problem? What are your user experiences with the ZeroPi?

I have a similiar device (NanoPi R1) and I'm not very happy with this unit. Its FriendlyWrt is based on OpenWrt 18.06.1.

Although I disabled wireless, the brcmfmac driver panics from time to time and floods the system log. I blocked the brcmfmac modules from loading and the panics vanished.

Another problem was, that the NanoPi R1 from time to time suddenly rebooted, without outputing any error message.

After experimenting nearly two months I substituted the NanoPi R1 with my old RPI4B, which had an uptime of over two months and operated during this time flawlessly.

It works awesome for what I'm doing, which is a portable EasyTether router. I'd be much happier if it had Wi-Fi, of course. I didn't want to use a mini dongle that they recommend simply because of the range. I'm trying to make this work easily for several other people.

I haven't had much time to work on it since yesterday, just a little bit here and there. It looks like it's just a driver issue, but that ends up being a major problem because none of the drivers are in the Repository, and the ones that I installed don't work. I'm not that confident in my own experience with building drivers.

There's an official OpenWrt release for the Nano Neo, which is almost an identical unit, but I can't get it to load and there are no instructions. For reference, the FriendlyWrt Neo build works perfectly on this unit.

As for ZeroPi, its an Allwinner H3 based target, adding support for such boards is too easy, the tough thing is to get its PR merged.

I have addeded support for the NanoPi R1, NanoPi R2S, and both of them hasn't gone through the PR, once this goes in https://github.com/openwrt/openwrt/pull/2990, I might also add support for the ZeroPi.

1 Like

Thank you for taking the time to reply. The unfortunate issue is that the 80211 tools at rt2800 drivers aren't in the repository that FriendlyWrt uses and the ones I installed manually don't work because the kernel dependencies don't match. I almost got the official build working by manually coping in the files to the only file structure that this thing seems to like. The official kernel still won't boot, though. I've been looking for the legacy kernel repositories and can't seem to find the right ones for 4.14.111. 18.06.2 is 4.14.95 and 18.06.3 is 4.14.128.

My next step is to build my own kernel image using the (not so)Friendly(so far) instructions, but I've never done it before.

1 Like

I appreciate your input, thank you. But, I'm not knowledgeable enough to know how to use the information you have provided.

So I found 4.14.111 under Snapshots. LuCi still didn't like it, but I ignored the kernel dependency and installed all of the packages, the drivers still don't load and wifi config does not populate /etc/config/wireless.

Ok i see, i ran into these issues in the past as i also have many h3 and h2+ boards that i made mesh firmware for using those same RT2800 usb dongles. This was just for testing as the wifi performance is not so good.

That is how i knew what extra paackages to add. But they best added when compiled from source tree

Thank you for adding these boards. I also have the R1S for which Openwrt support not been added.

Do you have the time to help detail the steps required to add support for the R1S board ?

Sure. I'll prepare the code for you. H3 or H5?

I have H3 variant

Follow the normal procedure of OpenWrt.
Select the appropriate device at make menuconfig

image

You can also use github actions to compile automated builds.

Thank you kindly, will report back once I have tested

I ran into a build error ?

make[4]: Entering directory '/media/raid/storage/fresh-git/R1S/openwrt-nanopi-r1/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/u-boot-nanopi_r1s_h3/u-boot-2020.04'
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  CHK     include/generated/generic-asm-offsets.h
  CHK     include/generated/asm-offsets.h
  CC      lib/efi_loader/helloworld.o
  AS      lib/efi_loader/efi_crt0.o
  CC      lib/efi_loader/efi_reloc.o
  CC      lib/efi_loader/efi_freestanding.o
  LD      lib/efi_loader/helloworld_efi.so
  OBJCOPY lib/efi_loader/helloworld.efi
  DTC     arch/arm/dts/sun8i-h3-nanopi-r1s-h3.dtb
arch/arm/dts/sunxi-h3-h5.dtsi:207.21-218.5: ERROR (phandle_references): /soc/mmc@1c10000: Reference to non-existent node or label "mmc1_pins_a"

  also defined at arch/arm/dts/sun8i-h3.dtsi:254.7-264.3
  also defined at arch/arm/dts/.sun8i-h3-nanopi-r1s-h3.dtb.pre.tmp:108.7-126.3
arch/arm/dts/sun8i-h3-nanopi.dtsi:76.14-85.4: ERROR (phandle_references): /r_gpio_keys: Reference to non-existent node or label "sw_r_npi"

  also defined at arch/arm/dts/.sun8i-h3-nanopi-r1s-h3.dtb.pre.tmp:62.14-74.4
ERROR: Input tree has errors, aborting (use -f to force output)
Check /media/raid/storage/fresh-git/R1S/openwrt-nanopi-r1/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/u-boot-nanopi_r1s_h3/u-boot-2020.04/arch/arm/dts/.sun8i-h3-nanopi-r1s-h3.dtb.pre.tmp for errors
make[6]: *** [scripts/Makefile.lib:314: arch/arm/dts/sun8i-h3-nanopi-r1s-h3.dtb] Error 1
make[5]: *** [dts/Makefile:43: arch-dtbs] Error 2
make[4]: *** [Makefile:1090: dts/dt.dtb] Error 2
make[4]: Leaving directory '/media/raid/storage/fresh-git/R1S/openwrt-nanopi-r1/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/u-boot-nanopi_r1s_h3/u-boot-2020.04'
make[3]: *** [Makefile:344: /media/raid/storage/fresh-git/R1S/openwrt-nanopi-r1/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/u-boot-nanopi_r1s_h3/u-boot-2020.04/.built] Error 2
make[3]: Leaving directory '/media/raid/storage/fresh-git/R1S/openwrt-nanopi-r1/package/boot/uboot-sunxi'
time: package/boot/uboot-sunxi/nanopi_r1s_h3/compile#1.56#0.59#2.07
make[2]: *** [package/Makefile:113: package/boot/uboot-sunxi/compile] Error 2
make[2]: Leaving directory '/media/raid/storage/fresh-git/R1S/openwrt-nanopi-r1'
make[1]: *** [package/Makefile:107: /media/raid/storage/fresh-git/R1S/openwrt-nanopi-r1/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/stamp/.package_compile] Error 2
make[1]: Leaving directory '/media/raid/storage/fresh-git/R1S/openwrt-nanopi-r1'
make: *** [/media/raid/storage/fresh-git/R1S/openwrt-nanopi-r1/include/toplevel.mk:224: world] Error 2

this what i did

git clone https://github.com/jayanta525/openwrt-nanopi-r1.git

cd openwrt-nanopi-r1

#your commit to add the R1S
git checkout 91e73618498edeefd05e84897ec4f48cdbdd08b1

cp feeds.conf.default feeds.conf

./scripts/feeds update -a; ./scripts/feeds install -a;

make V=s menuconfig

#Selected the H3 R1S target
make -j5

Is this correct ?

openwrt-nanopi-r1/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/u-boot-nanopi_r1s_h3/u-boot-2020.04/arch/arm/dts/.sun8i-h3-nanopi-r1s-h3.dtb.pre.tmp
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)

#include "sun8i-h3-nanopi.dtsi"

/ {
	model = "FriendlyARM NanoPi R1S H3";
	compatible = "friendlyarm,nanopi-r1s-h3", "allwinner,sun8i-h3";

	wifi_pwrseq: wifi_pwrseq {
		compatible = "mmc-pwrseq-simple";
		pinctrl-names = "default";
		pinctrl-0 = <&wifi_en_npi>;
		reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
		post-power-on-delay-ms = <200>;
	};

	reg_gmac_3v3: gmac-3v3 {
		compatible = "regulator-fixed";
		regulator-name = "gmac-3v3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		startup-delay-us = <100000>;
		enable-active-high;
		gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
	};

	rfkill_bt {
		compatible = "rfkill-gpio";
		pinctrl-names = "default";
		pinctrl-0 = <&bt_pwr_pin>;
		reset-gpios = <&pio 6 13 GPIO_ACTIVE_HIGH>; /* PG13 */
		clocks = <&osc32k>;
		clock-frequency = <32768>;
		rfkill-name = "sunxi-bt";
		rfkill-type = "bluetooth";
	};

	leds {
		/delete-node/ status;
		/delete-node/ pwr;
		status {
			label = "status_led";
			gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
		};

		led2 {
			label = "LED2";
			gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>;
			default-state = "off";
			linux,default-trigger = "netdev";
		};

		led3 {
			label = "LED3";
			gpios = <&pio 0 9 GPIO_ACTIVE_HIGH>;
			default-state = "off";
			linux,default-trigger = "netdev";
		};
	};

	r_gpio_keys {
		compatible = "gpio-keys";
		input-name = "k1";
		pinctrl-names = "default";
		pinctrl-0 = <&sw_r_npi>;

		/delete-node/ k1;
		reset {
			label = "reset";
			linux,code = <BTN_1>;
			gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
		};
	};
};

&pio {
	bt_pwr_pin: bt_pwr_pin@0 {
		pins = "PG13";
		function = "gpio_out";
	};
};

&r_pio {
	wifi_en_npi: wifi_en_pin {
		pins = "PL7";
		function = "gpio_out";
	};
};

&mdio {
	ext_rgmii_phy: ethernet-phy@1 {
		reg = <7>;
	};
};

&emac {
	pinctrl-names = "default";
	pinctrl-0 = <&emac_rgmii_pins>;
	phy-supply = <&reg_gmac_3v3>;
	phy-handle = <&ext_rgmii_phy>;
	phy-mode = "rgmii";

	allwinner,leds-active-low;
	status = "okay";
};

&mmc1 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc1_pins_a>;
	vmmc-supply = <&reg_vcc3v3>;
	vqmmc-supply = <&reg_vcc3v3>;
	mmc-pwrseq = <&wifi_pwrseq>;
	bus-width = <4>;
	non-removable;
	status = "okay";

	/* compitable with rtl8189/ap6256 */
	brcmf: bcrmf@1 {
		reg = <1>;
		compatible = "brcm,bcm4329-fmac";
		interrupt-parent = <&pio>;
		interrupts = <6 10 IRQ_TYPE_LEVEL_HIGH>; /* PG10 / EINT10 */
		interrupt-names = "host-wake";
	};
};

&usb_otg {
	dr_mode = "peripheral";
	status = "okay";
};

&i2c0 {
	status = "okay";

	eeprom@51 {
		compatible = "microchip,24c02";
		reg = <0x51>;
		pagesize = <16>;
	};
};
#include "sunxi-u-boot.dtsi"

you don't have to cherry-pick commits (i have made multiple commits):

follow:

git clone --depth 1 https://github.com/jayanta525/openwrt-nanopi-r1.git -b nanopi-r1s-h3-h5 openwrt
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
make -j5

Seems like uboot dts is missing some dts nodes. Modifications to dts might be required.

Please try building with the latest commits from github.

I am constantly pushing commits to github, to adapt with the compile errors, use

git pull

Let me know if you come across errors, i will have a look at it.

Ok, will do

still same error ?

  DTC     arch/arm/boot/dts/sun8i-h3-nanopi-r1s-h3.dtb
arch/arm/boot/dts/sunxi-h3-h5.dtsi:206.21-217.5: ERROR (phandle_references): /soc/mmc@1c10000: Reference to non-existent node or label "mmc1_pins_a"

  also defined at arch/arm/boot/dts/sun8i-h3.dtsi:212.7-222.3
  also defined at arch/arm/boot/dts/sun8i-h3-nanopi-r1s-h3.dts:108.7-126.3
arch/arm/boot/dts/sun8i-h3-nanopi.dtsi:76.14-85.4: ERROR (phandle_references): /r_gpio_keys: Reference to non-existent node or label "sw_r_npi"

  also defined at arch/arm/boot/dts/sun8i-h3-nanopi-r1s-h3.dts:62.14-74.4
ERROR: Input tree has errors, aborting (use -f to force output)
make[6]: *** [scripts/Makefile.lib:285: arch/arm/boot/dts/sun8i-h3-nanopi-r1s-h3.dtb] Error 2
make[5]: *** [Makefile:1251: dtbs] Error 2
make[5]: Leaving directory '/media/raid/storage/fresh-git/R1S/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-sunxi_cortexa7/linux-5.4.42'
make[4]: *** [Makefile:34: /media/raid/storage/fresh-git/R1S/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-sunxi_cortexa7/linux-5.4.42/.image] Error 2
make[4]: Leaving directory '/media/raid/storage/fresh-git/R1S/openwrt/target/linux/sunxi'
make[3]: *** [Makefile:13: install] Error 2
make[3]: Leaving directory '/media/raid/storage/fresh-git/R1S/openwrt/target/linux'
time: target/linux/install#494.19#43.32#555.83
make[2]: *** [target/Makefile:25: target/linux/install] Error 2
make[2]: Leaving directory '/media/raid/storage/fresh-git/R1S/openwrt'
make[1]: *** [target/Makefile:19: /media/raid/storage/fresh-git/R1S/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/stamp/.target_install] Error 2
make[1]: Leaving directory '/media/raid/storage/fresh-git/R1S/openwrt'
make: *** [/media/raid/storage/fresh-git/R1S/openwrt/include/toplevel.mk:224: world] Error 2
user@t30:/media/raid/storage/fresh-git/R1S/openwrt$ git pull
Already up to date.

The first error was with uboot, second error is with linux kernel. I will look at. Please drop a private message at my profile.