Add support for NanoPi R2C


 Share

1 1
Go to solution Solved by schwar3kat,

Recommended Posts

Armbian is a community driven open source project. Do you like to contribute your code?

  • Solution

@thelinuxguy

Your issue with R2S is probably an incompatible device tree in uboot and kernal.
The drivers for both NIC's are in the build, but r8153B has a bug that is being fixed.

You could try with the Orangepi R1plus LTS image which appears to be similar.  If the rest of the device tree is similar, there is a chance that it will work.
The drivers for the NIC's are the same although the chips are different YT8521S vs YT8523B
There is a bug in the latest image that affects the r8153B driver. 
There is a PR in progress  merged to fix this that should become available in the nightly builds in the next few days.

If you try it, please let us know the results.

Regards
Kat

 

Link to post
Share on other sites

On 5/7/2022 at 3:28 AM, schwar3kat said:

@thelinuxguy

If you try it, please let us know the results.

 

 

Hi, thanks for this tip. I don't mind testing and sharing the results.

I believe you mean to try the build from: https://www.armbian.com/orangepi-r1plus-lts/ 

 

I'm new to Armbian - where do I find the "nightly" builds you spoke of? I don't see any links for any packages recently updated. From the link above; those stable images were last updated February 27, 2022.  Could you share how to get to unstable builds?

Link to post
Share on other sites

 @thelinuxguy
Yes, that's the one.  It looks pretty close hardware wise.
 

Nightly builds can be activated once you have a build in place and are internet linked. 
Use the YT8521S NIC, it's the one not impacted by the bug (if it works).


armbian-config, then from the menu, System then Nightly.

The new version of Armbian due out later this month will have the fix.

 

Link to post
Share on other sites

Or if you run a recent version of Ubuntu or a derivative like Mint then you can use the Armbian build system.  It's pretty easy.
(Officially supported version is currently Ubuntu Jammy, but others are unofficially allowed (without support), and for others not on the allowed list, the OS check can be bypassed).
 

Log in as root (sudo su) and run:

$ mkdir /build-armbian  (wherever you want and named whatever you want)
$ cd /build-armbian

$ apt-get -y -qq install git  
$ git clone --depth 1 https://github.com/armbian/build  

$ cd build  

Run the script

$ ./compile.sh
Follow the menu's  (build time is slower the first time because it downloads, compiles, and builds caches, (and cpu power makes a big difference)

https://docs.armbian.com/Developer-Guide_Build-Preparation/

You can develop your own patches etc.

Link to post
Share on other sites

22 hours ago, schwar3kat said:

 @thelinuxguy
Yes, that's the one.  It looks pretty close hardware wise.
 

Nightly builds can be activated once you have a build in place and are internet linked. 
Use the YT8521S NIC, it's the one not impacted by the bug (if it works).


armbian-config, then from the menu, System then Nightly.

The new version of Armbian due out later this month will have the fix.

 


I'm happy to report that Bullseye (Feb 2022) OrangePi R1+ LTS works on nanopi R2C Plus. I was able to boot it and connect to the internet, switched to Nightly builds and its updating now.

 

Thanks @schwar3kat! I think your build could probably be tagged for this SBC also on armbian.com :) 

 

Generating locales: en_US.UTF-8

root@orangepi-r1plus-lts:~#
root@orangepi-r1plus-lts:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether e2:b2:e8:xxxx brd ff:ff:ff:ff:ff:ff
3: lan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether e2:b2:e8xxx2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.232.235/24 brd 192.168.232.255 scope global dynamic noprefixroute lan0
       valid_lft 43118sec preferred_lft 43118sec
    inet6 fd0a:23d5:ce4a::23f/128 scope global dynamic noprefixroute
       valid_lft 43120sec preferred_lft 43120sec
    inet6 fd0a:23d5:ce4a:0:ff88:4de8:11fa:b0c5/64 scope global noprefixroute
       valid_lft forever preferred_lft forever
    inet6 fe80::1278:b297:327e:1afc/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
root@orangepi-r1plus-lts:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=13.2 ms
^C
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 13.233/13.233/13.233/0.000 ms
root@orangepi-r1plus-lts:~#

 

Link to post
Share on other sites

Only 1 out of 2 NICs work on this image, the "WAN" interface is not working at all.


Some debug info

root@orangepi-r1plus-lts:~# lspci
root@orangepi-r1plus-lts:~# lshw -class network
  *-network:0 DISABLED
       description: Ethernet interface
       physical id: 6
       logical name: eth0
       serial: e2:b2:e8:be:a9:e2
       capabilities: ethernet physical
       configuration: broadcast=yes multicast=yes
  *-network:1
       description: Ethernet interface
       physical id: 7
       bus info: usb@5:1
       logical name: lan0
       serial: e2:b2:e8:be:a9:02
       size: 1Gbit/s
       capacity: 1Gbit/s
       capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8152 driverversion=v1.12.12 duplex=full ip=192.168.232.235 link=yes multicast=yes port=MII speed=1Gbit/s
root@orangepi-r1plus-lts:~# lshw -class network -short
H/W path  Device  Class      Description
========================================
/6        eth0    network    Ethernet interface
/7        lan0    network    Ethernet interface
root@orangepi-r1plus-lts:~# ifconfig eth0
eth0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether e2:b2:e8:be:a9:e2  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 40

root@orangepi-r1plus-lts:~# ifup eth0
ifup: unknown interface eth0
root@orangepi-r1plus-lts:~# ethtool eth0
netlink error: Device or resource busy
netlink error: Device or resource busy
netlink error: Device or resource busy
netlink error: Device or resource busy
netlink error: Device or resource busy
No data available

 

Link to post
Share on other sites

Three quarters of the way there :)
At least you now have something to start with.

If I was you, I would try the rk3328-nanopi-r2-rev06.dtb device tree that is included in the current build (and/or any other promising looking dtb's). 
Easiest way is to open /boot/dtb/rockchip and rename rk3328-orangepi-r1-plus-lts.dtb to rk3328-orangepi-r1-plus-lts.dtb.bak and rename rk3328-nanopi-r2-rev06.dtb to rk3328-orangepi-r1-plus-lts.dtb.   Or you can modify armbianEnv.txt  but I can't remember off hand if there is another step to make this work which is why I mentioned the renaming method. 
If this works, you can look into using Armbian build to customize a build for your board (and maybe contributing as a community build or supporting it).  This is quite simple because it's all config with no kernal patching.

If this doesn't work, most likely, either the device tree is wrong or there are changes required to the kernel networking code to enumerate/identify/initialize the NIC. (The NIC drivers are already in Armbian and should in theory work).  

If you can find a build with source for your device on some other Linux (preferably on the same kernel version) with dts (source code for a dtb) or even a dtb and a set of kernel patches, then you can ignore the NIC patch(es) and see if you can modify the other bits to work with code in the current kernels in Armbian build.

It can take an enormous amount of effort to research this sort of thing, so it's unlikely that anyone here would be willing to attempt it for you.
 

Link to post
Share on other sites

18 hours ago, schwar3kat said:


Easiest way is to open /boot/dtb/rockchip and rename rk3328-orangepi-r1-plus-lts.dtb to rk3328-orangepi-r1-plus-lts.dtb.bak and rename rk3328-nanopi-r2-rev06.dtb to rk3328-orangepi-r1-plus-lts.dtb.   

 

I tried this and while there is NIC led detection the interface 'eth0' is not coming up.

 

[   19.482535] yzhang..read phyaddr=3, phyid=0000011a
[   19.484279] yt8521_config_init, 8521 init call out.
[   19.484348] rk_gmac-dwmac ff540000.ethernet eth0: PHY [stmmac-0:03] driver [YT8521 Ethernet] (irq=POLL)
[   19.492246] rk_gmac-dwmac ff540000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   19.696649] rk_gmac-dwmac ff540000.ethernet: Failed to reset the dma
[   19.696668] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   19.696676] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_open: Hw setup failed
[   19.806336] IPv6: ADDRCONF(NETDEV_CHANGE): lan0: link becomes ready
[   19.806745] r8152 5-1:1.0 lan0: carrier on
[   19.926727] yzhang..read phyaddr=3, phyid=0000011a
[   19.929010] yt8521_config_init, 8521 init call out.
[   19.929080] rk_gmac-dwmac ff540000.ethernet eth0: PHY [stmmac-0:03] driver [YT8521 Ethernet] (irq=POLL)
[   19.933986] rk_gmac-dwmac ff540000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   20.142202] rk_gmac-dwmac ff540000.ethernet: Failed to reset the dma
[   20.142226] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   20.142234] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_open: Hw setup failed
[   20.270665] yzhang..read phyaddr=3, phyid=0000011a
[   20.273435] yt8521_config_init, 8521 init call out.
[   20.273493] rk_gmac-dwmac ff540000.ethernet eth0: PHY [stmmac-0:03] driver [YT8521 Ethernet] (irq=POLL)
[   20.279678] rk_gmac-dwmac ff540000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   20.490621] rk_gmac-dwmac ff540000.ethernet: Failed to reset the dma
[   20.490640] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   20.490648] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_open: Hw setup failed
[   20.606662] yzhang..read phyaddr=3, phyid=0000011a
[   20.609408] yt8521_config_init, 8521 init call out.
[   20.609478] rk_gmac-dwmac ff540000.ethernet eth0: PHY [stmmac-0:03] driver [YT8521 Ethernet] (irq=POLL)
[   20.612215] rk_gmac-dwmac ff540000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   20.820330] rk_gmac-dwmac ff540000.ethernet: Failed to reset the dma
[   20.820353] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   20.820361] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_open: Hw setup failed
[   20.950583] yzhang..read phyaddr=3, phyid=0000011a
[   20.953258] yt8521_config_init, 8521 init call out.
[   20.953318] rk_gmac-dwmac ff540000.ethernet eth0: PHY [stmmac-0:03] driver [YT8521 Ethernet] (irq=POLL)
[   20.958349] rk_gmac-dwmac ff540000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   21.162222] rk_gmac-dwmac ff540000.ethernet: Failed to reset the dma
[   21.162243] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   21.162252] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_open: Hw setup failed
[   21.266619] yzhang..read phyaddr=3, phyid=0000011a
[   21.269373] yt8521_config_init, 8521 init call out.
[   21.269439] rk_gmac-dwmac ff540000.ethernet eth0: PHY [stmmac-0:03] driver [YT8521 Ethernet] (irq=POLL)
[   21.274531] rk_gmac-dwmac ff540000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   21.484185] rk_gmac-dwmac ff540000.ethernet: Failed to reset the dma
[   21.484204] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   21.484212] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_open: Hw setup failed
[   21.570709] yzhang..read phyaddr=3, phyid=0000011a
[   21.573383] yt8521_config_init, 8521 init call out.
[   21.573457] rk_gmac-dwmac ff540000.ethernet eth0: PHY [stmmac-0:03] driver [YT8521 Ethernet] (irq=POLL)
[   21.579269] rk_gmac-dwmac ff540000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   21.782205] rk_gmac-dwmac ff540000.ethernet: Failed to reset the dma
[   21.782229] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   21.782238] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_open: Hw setup failed
[   21.878581] yzhang..read phyaddr=3, phyid=0000011a
[   21.881258] yt8521_config_init, 8521 init call out.
[   21.881320] rk_gmac-dwmac ff540000.ethernet eth0: PHY [stmmac-0:03] driver [YT8521 Ethernet] (irq=POLL)
[   21.885576] rk_gmac-dwmac ff540000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   22.087406] rk_gmac-dwmac ff540000.ethernet: Failed to reset the dma
[   22.087429] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   22.087437] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_open: Hw setup failed
[   22.150811] yzhang..read phyaddr=3, phyid=0000011a
[   22.153504] yt8521_config_init, 8521 init call out.
[   22.153566] rk_gmac-dwmac ff540000.ethernet eth0: PHY [stmmac-0:03] driver [YT8521 Ethernet] (irq=POLL)
[   22.156509] rk_gmac-dwmac ff540000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   22.362126] rk_gmac-dwmac ff540000.ethernet: Failed to reset the dma
[   22.362145] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   22.362153] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_open: Hw setup failed

 

Not sure if the above hints at what the problem may be?

 

I see another version(rk3328-nanopi-r2-rev20.dtb) but other than the name I don't know how to compare to make sure i don't try a .dtb that will for sure never boot.  I did find this command shows me something but not sure what to look for dtc -I dtb -O dts rk3328-nanopi-r2-rev20.dtb

Link to post
Share on other sites

I have a feeling this is the .dts patch I need to convert to .dtb to possibly make this work but not sure how to do it. https://gitce.net/mirrors/lede/raw/commit/50d98983c2c26ea14dcc8bc02d0ee229fa1cdc80/target/linux/rockchip/patches-5.10/203-rockchip-rk3328-Add-support-for-FriendlyARM-NanoPi-R.patch

 

Tried a few things

dtc -I dts -O dtb -f rk3328-nanopi-r2c.dts -o rk3328-nanopi-r2c.dtb

$ dtc -I dts -O dtb -f rk3328-nanopi-r2c.dts -o rk3328-nanopi-r2c.dtb
Error: rk3328-nanopi-r2c.dts:11.1-9 syntax error
FATAL ERROR: Unable to parse input tree

Seems to be due to: #include "rk3328-nanopi-r2s.dts"


but rk3328-nanopi-r2s.dts exists and has data. maybe i converted DTB to DTS wrong when i tried to get the source from the same stuff thats inside /boot/dtb-5.15.25-rockchip64/rockchip

 

Link to post
Share on other sites

5 hours ago, thelinuxguy said:

Tried a few things

 

That's a patch, not an actual dts.  That patch modifies a Make file and creates a dts file.  The patch is part of a much larger build.  You can see an extra line being added into the Make file, (used to compile the new dts along with other dts's).  This is similar to the way Armbian build would do it, with one of the build scripts actually doing the compiling of all of the dtb's.

A possible way to do this would be to set up Armbian build and add the patch into build/patch/kernel/rockchip64-current.
You would need to manually modify the make part to match the Make file in /build/cache/sources/linux-mainline/linux-5.15.y/arch/arm64/boot/dts/rockchip.
Or a better way would be to use the CREATE_PATCHES=yes build option which would stop the build and allow you to modify the Make file then create a patch for you (second stop for kernel).  You could then use that patch to modify your original patch and build orangepi-R1plus-lts and the dtb will be compiled and end up with the others.  But you may not need to do any of that.

While looking up the patch path for this reply, I noticed a patch in Armbian Build called add-board-nanopi-r2c.patch. 
So I used the build menu (which I seldom do) and there is actually a build option for nanopi-r2c (it's not on the download list, implying that it's unsupported, and it's probably in the wrong menu (someone probably missed it when the menu's were split) and who knows if it has survived uBoot and kernel upgrades.   I see no archived builds, also implying that it's unsupported.  I've requested clarification of it's status, so it's likely to move to community support in the other (CSC/WIP/EOS/TVB) menu.  Unsupported boards are " build your own" only.

I suggest that you set up Armbian build and try to build it. 
You can use my instructions a few replies above either on an Ubuntu based PC or virtual machine.

Edit:  I built it.  One time only, it ties up my pc for an hour. Let me know if it works.
 https://drive.google.com/file/d/1nSug6EYF6O6CALLCaZA1PqRZE5VUBI2n/view?usp=sharing

Link to post
Share on other sites

6 hours ago, schwar3kat said:

 

Edit:  I built it.  One time only, it ties up my pc for an hour. Let me know if it works.
 https://drive.google.com/file/d/1nSug6EYF6O6CALLCaZA1PqRZE5VUBI2n/view?usp=sharing

 

Your replies are super helpful and insightful, thanks for that.

 

The good news:

1) The patch seems to "fix" the SBC board LED lights, they blink now as they usually do on FriendlyWRT and other builds.

 

The bad news is that WAN (eth0) seems to not get an IP address and so it seems the motorcom driver still doesn't work.

 

root@nanopi-r2c:~# lshw -class network
  *-network:0 DISABLED
       description: Ethernet interface
       physical id: 6
       logical name: eth0
       serial: e2:b2:e8:be:a9:e2
       capabilities: ethernet physical
       configuration: broadcast=yes multicast=yes
  *-network:1
       description: Ethernet interface
       physical id: 7
       bus info: usb@5:1
       logical name: lan0
       serial: e2:b2:e8:be:a9:02
       size: 10Mbit/s
       capacity: 1Gbit/s
       capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8152 driverversion=v1.12.12 duplex=half link=no multicast=yes port=MII speed=10Mbit/s
root@nanopi-r2c:~# ifconfig eth0 up
SIOCSIFFLAGS: Connection timed out

[  919.972527] yzhang..read phyaddr=3, phyid=0000011a
[  919.975199] yt8521_config_init, 8521 init call out.
[  919.975244] rk_gmac-dwmac ff540000.ethernet eth0: PHY [stmmac-0:03] driver [YT8521 Ethernet] (irq=POLL)
[  919.976159] rk_gmac-dwmac ff540000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[  920.184467] rk_gmac-dwmac ff540000.ethernet: Failed to reset the dma
[  920.184486] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[  920.184494] rk_gmac-dwmac ff540000.ethernet eth0: stmmac_open: Hw setup failed

 

Let me know if you have any ideas; I will setup a virtualbox VM to try armbian build to learn about building this myself following your previous comments.

Link to post
Share on other sites

The patch is enabled.  It was put there by the developer who configured the build. It is enabled by being in the directory.  build/patch/kernel/rockchip64-current (If you are building current)
Your board is in the rockchip64 family.  There are three active kernels legacy (currently 5.10y), current (5.15y) and edge (5.17y)

The drivers are slightly different between 5.10 and 5.15/5.17 so it may be worth trying the legacy build.
I suspect that the build worked on an earlier kernel version and that it has has not been maintained on newer kernels.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

1 1