Support for NanoPi R2C?

Hi all,
I just got a new NanoPi R2C PLUS (seems to be the successor of NanoPi R2S. The PLUS type has additional internal 8GB flash).
https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R2C_Plus

I started with the image for R2S and got no network connection.

Connected to TTY debug port and found this here in “dmesg”:
[ 10.764767] rk_gmac-dwmac ff540000.ethernet eth0: no phy at addr -1
[ 10.765340] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)

The reason is probably that the R2C uses a new PHY device YT8521S instead of the RTL8211E-VB-CG they used with the R2S.
This means with the image “DietPi_NanoPiR2S-ARMv8-Bullseye.img” for R2S the WAN port cannot be used.

Also I found no way to access the built in 8GB Flash. I expected to see it in /dev/mmcblk1 but nothing :cry:

Is there a chance for a workaround or new image for the NanoPi R2C that fixes that? Would be really great :smiley:
I am not skilled enough to fix it by myself.

Best DrCWO

It worked when I tested last. The question is which chip is assumed for which adapter. There is a dedicated R2C bootloader available, can you try that one:

apt update
apt install linux-u-boot-nanopi-r2c-current
. /usr/lib/u-boot/platform_install.sh
write_uboot_platform "$DIR" "$(lsblk -npo PKNAME "$G_ROOTFS_DEV")"
reboot

If it doesn’t work, probably the edge kernel and bootloader does:

apt purge linux-u-boot-nanopi-r2c-current
apt install linux-{image,dtb}-edge-rockchip64 linux-u-boot-nanopi-r2c-edge
. /usr/lib/u-boot/platform_install.sh
write_uboot_platform "$DIR" "$(lsblk -npo PKNAME "$G_ROOTFS_DEV")"

Hi MichaIng,
thanks’ for the quick reply.

I ran the first three lines where I had to a+x the platform_install.sh script before.
It started but gave no response. Is this correct?

I had no luck with the command:
write_uboot_platform “$DIR” “$(lsblk -npo PKNAME “$G_ROOTFS_DEV”)”

It said:
bash: write_uboot_platform: command not found

Also with a global find I was not able to discover write_uboot_platform

Did I miss anything?
Best DrCWO

Don’t forget the dot (which is separated by a space) in at the beginning of the 3rd command. This script is not executed but sourced (hence no execute bit required). It loads the function which is the 4th command.

Thank you, now I understood. For me this is shell magic :wink:
I did as was told. No change with the first approach.
Second approach I see a change (first bold) but this does not fix the issue (seconf bold) :cry: :frowning:
See dmesg and uname outputs.

[ 8.066903] r8152 5-1:1.0: Direct firmware load for rtl_nic/rtl8153b-2.fw failed with error -2
[ 8.066935] r8152 5-1:1.0: unable to load firmware patch rtl_nic/rtl8153b-2.fw (-2)

[ 8.074629] r8152 5-1:1.0 eth1: v1.12.12
[ 8.083224] usbcore: registered new interface driver btusb
[ 8.181769] random: crng init done
[ 8.181788] random: 7 urandom warning(s) missed due to ratelimiting
[ 8.405453] rk_gmac-dwmac ff540000.ethernet eth0: no phy at addr -1
[ 8.406040] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)

[ 8.496352] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 8.496374] Bluetooth: BNEP filters: protocol multicast
[ 8.496391] Bluetooth: BNEP socket layer initialized
[ 8.519551] NET: Registered PF_ALG protocol family
[ 12.075731] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[ 12.076497] r8152 5-1:1.0 eth1: carrier on
root@rooExtend-X:/home/pi# uname -a
Linux rooExtend-X 5.15.18-rockchip64 #trunk.0023 SMP PREEMPT Sat Jan 29 16:01:11 UTC 2022 aarch64 GNU/Linux
root@rooExtend-X:/home/pi#

Best DrCWO

Okay, thanks for testing. Just to be sure, the R2C U-Boot is the only one installed now, right?

dpkg -l | grep 'linux-'

And the LAN adapter (eth1) works fine, right?

In case I’ll report to Armbian.

Please don’t thank me!
It is my joy to thank you for getting into my issue.

This is what I get from your command:

root@rooExtend-X:/home/pi/rooExtend# dpkg -l | grep 'linux-'
ii  binutils-aarch64-linux-gnu     2.35.2-2                       arm64        GNU binary utilities, for aarch64-linux-gnu target
ii  linux-base                     4.6                            all          Linux image base package
ii  linux-dtb-current-rockchip64   21.08.2                        arm64        Linux DTB, version 5.10.63-rockchip64
ii  linux-dtb-edge-rockchip64      22.02.0-trunk.0023             arm64        Armbian Linux DTB, version 5.15.18-rockchip64 edge
ii  linux-image-current-rockchip64 21.08.2                        arm64        Linux kernel, version 5.10.63-rockchip64
ii  linux-image-edge-rockchip64    22.02.0-trunk.0023             arm64        Linux kernel, armbian version 5.15.18-rockchip64 edge
ii  linux-libc-dev:arm64           21.08.6                        arm64        Armbian Linux support headers for userspace development
ii  linux-u-boot-nanopi-r2c-edge   21.08.8                        arm64        Uboot loader 2021.07

And yes, the LAN adapter name “LAN” printed on the box and originally named lan0 in the dietpi setup works fine.
I renamed it to eth0 in /etc/udev/rules.d/70-persistent-net.rules

Best DrCWO

By the way,
I checked the wiki for both the R2S and R2C.

The R2C uses a new PHY device YT8521S for eth0 instead of the RTL8211E-VB-CG they used with the R2S.

In my opinion this is what creates the issue.

Best DrCWO

I found some resources regarding YT8521S but no idea how to use them. Hope this helps.
https://github.com/Poco-Ye/rk-ethernet/blob/master/YT8521S.zip
Best DrCWO

And here are the driver sources:
https://github.com/cnxsoft/YT8521S/tree/main/motorcom-phy-sdk-linux/linux/drivers/net/phy

Who is able or willing to integrate it in the kernel?
I am not able :cry: Never compiled a kernel…

From DietPi side we don’t create nor provide any kernel. We always use the one provided by the underlying base image.

I just found the PR indicating that it’s is or was supposed to work already: https://github.com/armbian/build/pull/3138

Ah, you needed to use udev rules to rename the adapter to eth0, right we accidentally added unintended double quotes in /etc/armbianEnv.txt around net.ifnames=0 setting. Removing those makes the udev rule obsolete. They are removed automatically with next DietPi update.

As I can’t understand most of the things in your the conversation with igorpecovnik but I removed the double quotes.

Removing the double quotes in /boot/armbianEnv.txt (i can’t find the file in /etc ?) did not change the situation.
I removed it in my latest installation after the updates and I also did a fresh install from
DietPi_NanoPiR2S-ARMv8-Bullseye.img and removed the double quotes before flashing it on the SD-Card.
Still the same error :cry:

I encountered one more minor issue I like to report:
Booting with serial terminal (putty) attached, it looks like the serial bitrate of the bootloader is wrong (I see cryptic characters). If I press CR after the boot I get the login prompt and can login. My putty settings are 115200/8/1/no parity

As I am really interested to make it run, I would be happy if you might give me more tips how it can be improved. I will test as soon as I receive your feedback.

Next on the fresh install without the double quotes I tested the new Uboot and new kernel.

Linux DietPi 5.15.18-rockchip64 #trunk.0023 SMP PREEMPT Sat Jan 29 16:01:11 UTC 2022 aarch64 GNU/Linux

Still the same issue…

Hi MichaIng,
I also wrote some lines in the Githup explaining the issue a bit. Maybe his will help.
Did you achieve any further success?

Hi MichaIng,
the git discussion was closed.

We don’t support 3rd party users since we can’t possibly ours and support is in general very limited. Migrate to Armbian and use procedure as we are requesting: https://www.armbian.com/bugs/ (this saves us some time)

As I am a 3rd party user I am not supported and therefor not able to be helpful any more. :cry:

You basically posted on the wrong PR :slight_smile:. We already know that that patch didn’t broke the WAN chip, since it was merged long after the kernel packages were built. With some luck, that patch may even fix it.

Also note that Armbian, as you recognised, is very sensitive about who they “officially” support, and which SBC, and the NanoPi R2C never was officially support, there are no Armbian images for it, no download page, no support form, which is the reason I asked carefully on the other PR, more as a report, in case the author of the original R2C “support” (only unofficially, kernel-wise) patch is still around and can verify that it broke somewhere between September and January.

Just as a last attempt to rule anything else out, you could try the latest Armbian R2S image: https://redirect.armbian.com/nanopi-r2s/Bullseye_current

If that doesn’t work, go though the steps as before, first flashing the “current” R2C U-Boot, then the “edge” versions of kernel and U-Boot. But since the R2C is not officially supported, the bug report suggested by Igor cannot be done anyway, but we need to wait for an official Armbian NanoPi R2C maintainer: https://forum.armbian.com/staffapplications/application/8-single-board-computer-maintainer/

Thank you your your support and sorry that I behaved the wrong way in the tread.
I will leave home for a holiday tomorrow and will be back in three weeks.
Probably I won’t find time today to test your approach.

When I am back I’l test and let you know. If there might be news regarding this until then please let me know.
Best DrCWO

No problem. Let’s see whether the contributors of the R2C support code respond, or probably Armbian finds a maintainer for this SBC and ships an official image (and assured kernel support).

Her you can see the maintainer of R2S https://www.armbian.com/nanopi-r2s/ :wink: :wink: