NanoPI R2S is a great OpenWrt device

I have been running FriendlyWRT on my R2S for a few months now without issue, but I want to move to OpenWRT (which I have run on Pi3 and Pi4 for a while as well). I have been using a serial GPS receiver to my OpenWRT as an NTP server, I rebuilt FriendlyWRT to enable GPIO TX (UART1_TX / GPIO3_A4) and RX (UART1_RX / GPIOG3_A6) as well as PPS (GPIO2_A2 / IR_RX).
Might I suggest that these also be enabled for OpenWRT by default.
I could provide the FriendlyWRT dtsi mods I made to anyone willing to port them into OpenWRT for the R2S. Then for those with serial GPS receivers, after a bit of soldering and drilling holes they can have stratum 1 time server (as well as a router).



I received the NanoPi R2S board a few days back and have been performing some stress test for a while. I am grateful to @xiaobo for buying me this board.

I have noticed in both armbian and OpenWrt, the eth1 (LAN) MAC address is fixed as "DA:56:E2:6D:13:CC". I am not sure this is also the case with friendlywrt (haven't tested friendlywrt).

I tried some fixes by removing some patch files, but that leads to kernel generating random MAC address on every boot.

Since, most of the patches are taken from armbian, i will create an issue at armbian/build and will wait for their opinions.

PR at OpenWrt:

I have seen @xiaobo has created a PR at :

But since @lucize 's PR for target rk3328 is already pending, it's better suggested to wait for the latter to get merged first.

Seems that the USB3 drivers are different, i haven't checked with the driver at the PR by @lucize . I will check that soon.

You can compile OpenWrt just the way you have compiled FriendlyWrt to use the Serial GPS receiver.

Repository is available at:

OK , Wait for @lucize.

I see you closed the PR. @jayanta525 Wouldn’t it be better to leave it out there for visibility and let it get pulled/merged when they’re ready to do so?

I created a PR for FriendlyARM NanoPi R1, and it's still hasn't been merged. Its been open for nearly two months now.

Since, rk3328 target is added by @lucize 's PR, and it has got quite the attention from the maintainers and reviewers, let's hope it gets merged soon.

@_FailSafe Why not deal with github pull requests efficiently ?


@jayanta525 can you take a look at this script? They added it today, looks interesting and with the irq_optimize i think they have removed irqbalance from their build, but im not sure. Its like that script replaces what irqbalance do

1 Like

Thanks for the additional feedback on this @jayanta525. I was not aware of the thread you linked to, but that helps explain the request to wait on this PR until @lucize's PR gets merged.

I appreciate all the work going on here for this target! :+1:

On friendlywrt I didn't have the hard coded MAC address.

Totally agree with @_FailSafe here, thanks for all the effort you are putting in @lucize @jayanta525 @xiaobo :+1:

Put the image by @jayanta525 onto my R2S yesterday and just starting to play around with it now. If there's anything I can do to help test, let me know :slight_smile:

1 Like

Glad I found this fantastic topic. Thanks for all the work that's already been done on NanoPi R2S. It's a great alternative for home and small offices.
Has anyone tried to plug a 3rd Ethernet (via the USB 2.0 port) and load-balance wan traffic using mwan3? What should I do to make it work?

I think it will be a pretty common use case, specially in small offices. I have a few clients that need it.

In order to add serial GPS receiver support with PPS to Nano Pi R2S OpenWRT build provided by jayanta525 you can follow these instructions. The addition of uart1 will make GPIO pin 8 TX and pin 9 RX (these are labeled on the board, but there is no header).
"&gpio2 RK_PA2" is assigned for PPS which makes pin 7 (GPIO2_A2 / IR_RX) active for PPS (other pins may work, but I have found this pin to work very well).

I have searched the repo and found similar patches for other boards, so hopefully these changes can be adopted permanently.

PPS is enabled via kmod-pps and kmod-pps-gpio.

There does appear to already be a /dev/pps0 active, but that is not tied to pin 7; pin 7 will be /dev/pps1. I have not been able to track down where /dev/pps0 is being defined, it does have a signal (shown via "ppstest /dev/pps0") which is roughly 1 second, it may be the SYS LED or something similar. It is simple enough to change GPSD and/or NTPD to use pps1 so for now we can ignore pps0.

Code changes - I was able to edit
614 becomes 626:

+++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2-common.dtsi
@@ -0,0 +1,626 @@

I added the following below the leds: gpio-leds section (could also be above or farther down, does not matter) assert-falling-edge may not be needed:

+        pps {
+                 pinctrl-names = "default";
+                 compatible = "pps-gpio";
+                 gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_HIGH>;
+                 assert-falling-edge;
+        };

Enabling uart1 - this above "+&uart2", add

+&uart1 {
+        current-speed = <9600>;
+        status = "okay";

It does not appear that setting the speed to 9600 in this method works, dmesg still shows it at 1500000. I have used "/bin/stty -F /dev/ttyS1 9600" in rc.local to change it to my desired 9600 at boot.

I would love to get feedback on what might be defining /dev/pps0; this is not in FriendlyWRT. Also please let me know if anyone knows if there is a way to set uart1 speed properly to 9600 as the default.

Ethernet via USB 2.0 is usually not suggested.

My suggestion would be to spend around $29 and get a TP-Link SG108E switch.

With VLAN tagging, it would allow you to use every port of the switch as if it was connected to the NanoPi itself. (this is my current setup)

mwan3 should work with the default configuration, just don't forget to assign metric to each interfaces.

Have you considered trying out MPTCP instead of mwan3?

Good call on the VLAN tagging, @jayanta525. I haven't thought about that.

Currently I have a Ubiquiti ER-X running Openwrt 19.07. It works well, but the CPU can only handle around 200Mbps on SQM and my internet are 300Mbps + 120Mbps downstream, so I'm leaving a lot on the table.

I think I'll just configure the VLAN tagging on the Er-X to match the NanoPi then and let Nanopi do the routing and SQM.


Simple question: what is the tool you are using to do your SQM tests ?


This is an interesting change to build an NTP time server that I'm interested in. :grinning:

There are a few sites that describe how to do this with Raspberry Pi; I have run Pi3 and Pi4 as my OpenWRT router over the past ~2 years, I have been using Nano Pi R2S with FriendlyWRT for the past 2 months. You can buy a GPS receiver with PPS output for about $13 USD (you may need an antenna and adapter cable - another ~$13).

There are a couple tests I use:

  • speedtest-netperf is a package you can install via opkg and was written by some of the same gurus that brought SQM around to begin with. A word of caution, though... depending on your WAN speed, it's likely the script should NOT be run directly on your NanoPi. At higher WAN speeds, the routing cycles on your NanoPi can be disrupted by the load that netperf & netserver add during the speed test and your results will not be accurate in that case.
  • Flent is another awesome tool with a little bit of a learning curve. But definitely worth learning. I am not an expert in it by any means, but there are others (@moeller0 and @dtaht, just to name a few) that frequent this forum who can interpret the heck out of Flent charts and teach us all a thing or two.
  • Netdata-chart-sqm is another "tool" (not so much a test) I posted about here. There is absolutely nothing wrong with hard-numbers in a CLI--in fact I prefer that in most cases. But there are also some times where being able to get a more real-time visual of what is going on in your SQM queues & tins is beneficial. This chart is for getting that sort of visual via Netdata. I personally have found that Netdata itself is lighter on resources than even Collectd, but YMMV.

Hope my responses didn't overwhelm for a "simple question"... :slight_smile:

No perfect.

I would be interested to get netdata-chart-sqm.

I'm newbie to Openwrt. I tried to install git to clone netdata-chart-sqm but the package is not available. Do i need to update the disfeeds.conf or customfeeds.conf ?


No worries! Short answer is that it's not yet a package. I would be willing to take it that direction at some point if people find it useful, but I haven't gotten much feedback to-date.

To install it, follow the directions here:

I don't want to take this thread too far off-topic, so feel free to fire any more netdata-chart-sqm follow-up questions my way over on this thread: SQM Reporting?

1 Like