OrangePI 5B wifi crashes on boot

Required Information

  • DietPi version:
    G_DIETPI_VERSION_CORE=8
    G_DIETPI_VERSION_SUB=21
    G_DIETPI_VERSION_RC=1
    G_GITBRANCH=“master”
    G_GITOWNER=“MichaIng”

  • Distro version: bookworm

  • Kernel version: Linux picon 5.10.160-legacy-rk35xx

  • Architecture: arm64

  • SBC mode: Orange Pi 5 (aarch64) (NOTE: this is actually an OrangePi 5B)

  • Power supply used: the official one from Orange Pi

  • SD card used: SanDisk 64GB ultra

Steps to reproduce

With an OrangePI 5B on a fresh dietpi install:

first you need the following workaround to be able to see your wifi adapter:

  • sudo cp /boot/dtb/rockchip/overlay/orangepi-5-ap6275p.dtbo /boot/dtb/rockchip/overlay/rk3588-wifi-ap6275p.dtbo
  • set " overlays=wifi-ap6275p" in " /boot/dietpiEnv.txt"
  • reboot

then:
set up a WiFi network as usual with dietpi-config, wifi works
reboot

Expected behaviour

At startup, WiFi should connect to the SSID set up by dietpi-config.

Actual behaviour

WiFi does not connect at startup. It is, however, possible to connect to the WiFi manually using dietpi-config.

Extra details

I traced the issue to the ifup command.
At startup, ifup@wlan0.service starts and crashes: the command ifup --allow=hotplug wlan0; ifquery --state wlan0 fails with “command failed: Input/Output error (-5)”.
When using --verbose, we can see that the error comes from the following subcommand: iw dev wlan0 set power_save off

This issue is pretty reproducible, as it worked the same on two OrangePI 5B.

what happen if you login after reboot and try to bring up the WiFi device manually.

ifup wlan0

Hi, thanks for the reply.

If I reboot and ifup wlan0, it crashes with the same error. In fact, this is how I found that the issue was coming from the iw dev wlan0 set power_save off command.

My teammate has the same OrangePi and the same issue. It seems he solved it by executing ip link set wlan0 up before ifup --allow=hotplug wlan0. I can’t test that tonight, but I will report tomorrow to confirm or deny that this fixes it.

ok at least we might need to look into this further as the 5B has some different hardware (WiFi on board) compared to the regular 5. Probably a different image is required. Did you used the official DietPi Orange Pi 5 image?

Yes, I am using the official dietpi Orange Pi 5 image.

ok I guess we need a separat image, similar to other OrangePi B variants. I already did a ping towards our developer.

1 Like

I have good news: the fix indeed works! In summary, here are the steps we followed to fix the OrangePi 5B wifi issues in case that is useful to create a new image:

Problem 1: the WiFi module is not recognized in dietpi-config

sudo cp /boot/dtb/rockchip/overlay/orangepi-5-ap6275p.dtbo /boot/dtb/rockchip/overlay/rk3588-wifi-ap6275p.dtbo
put overlays=wifi-ap6275p in /boot/dietpiEnv.txt
reboot
the adapter can now be seen in dietpi-config! You can use it to connect to your wifi.

Problem 2: WiFi crashes at startup

Edit /etc/systemd/system/ifup@.service.d/dietpi.conf and put:

[Service]
Type=oneshot
ExecStart=
ExecStart=/bin/sh -ec 'ip link set %I up; ifup --allow=hotplug %I'

The important part being that we added ip link set %I up before the call to ifup. Reboot, and the WiFi should work! This was tested on two different OrangePi 5B.

1 Like

Do you have a USB-UART adapter to check the console? I want to find out whether we can find out about 5 vs 5B in U-Boot and apply the onboard WiFi overlay automatically, e.g. whether there is a ${variant} variable defined that we can check for.

Another thing I am wondering about: There is an explicit 5B overlay and I am confused that this does not contain onboard WiFi OOTB. Can you do the following:

sudo sed -i '/^setenv bootargs/s/"$/ \${fdtfile}"/' /boot/boot.cmd
sudo mkimage -C none -A arm64 -T script -d /boot/boot.cmd /boot/boot.scr
sudo reboot
cat /proc/cmdline

This to check whether really the 5B device tree is loaded.

And another question, do you know whether there is a 5B Plus with onboard WiFi? Orange Pi websites are pretty inconsistent, the wiki does not even list the 5B.

Ah, and another thing: Instead of applying the overlay, does it work as well to just load this module?

modprobe sprdwl_ng
1 Like

Hi,

I will try to check all of these next week: I still have an Orange Pi 5B to patch, so that will be the occasion to test.

And another question, do you know whether there is a 5B Plus with onboard WiFi? Orange Pi websites are pretty inconsistent, the wiki does not even list the 5B.

Yeah, the wiki seems incomplete. From what I understand, the 5B Plus model does not exist. The only models I am aware of are Orange Pi 5, Orange Pi 5 Plus (both without wifi) and Orange Pi 5B that has the onboard wifi module (http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/details/Orange-Pi-5B.html).

1 Like

Hi again,

Another thing I am wondering about: There is an explicit 5B overlay and I am confused that this does not contain onboard WiFi OOTB. Can you do the following:

sudo sed -i '/^setenv bootargs/s/"$/ \${s}"/' /boot/boot.cmd
sudo mkimage -C none -A arm64 -T script -d /boot/boot.cmd /boot/boot.scr
sudo reboot
cat /proc/cmdline

After that, the value of ${ftdfile} in /proc/cmdline is rockchip/rk3588s-orangepi-5.dtb. I guess this should be rockchip/rk3588s-orangepi-5b.dtb?

Ah, and another thing: Instead of applying the overlay, does it work as well to just load this module?

modprobe sprdwl_ng

It seems I do not have the sprdwl_ng module. Sorry, it’s been a while since the last time I had to work with kernel modules so I am not sure what to do there. Should I build it with the kernel sources somehow? Or should it have been included in the distro?

Do you have a USB-UART adapter to check the console? I want to find out whether we can find out about 5 vs 5B in U-Boot and apply the onboard WiFi overlay automatically, e.g. whether there is a ${variant} variable defined that we can check for.

Sorry, I do not have a USB-UART adapter at home so I have been unable to test for this, but I should be able to find one at the university.