Is there any dev working on the NanoPi R2S

Try this script

Do you have your modifications in a repo where we can take a look?

I see you noted CONFIG_IRQBALANCE. It’s interesting because I had tried irqbalance as well but found it didn’t separate eth0 and eth1 to different cores.

What kind of load were you putting on your NanoPi during the screen capture?

Only recorded here, CONFIG_IRQBALANCE is not implemented yet

Hi, I am trying to boot openwrt from orangepi r1 plus spi but don't know how to start
like editing dts modifying uboot etc. Could you help me please?

Hi,
i tried some things to bring mtd nor flash support

  1. i compiled this repo to run openwrt on my sd card https://github.com/jayanta525/openwrt-nanopi-r2s
    then mtd not exist in default shown below.
root@OpenWrt:/# cat /proc/mtd
dev:    size   erasesize  name
  1. i started to add SPI node to rockchip.dtb found in my sd card's mmcblk0p1 partition

i converted dtb to dts and add SPI support changes shown below (if it is true, please check)
right side original one, left side modified one to support SPI

/dts-v1/;							/dts-v1/;

/ {								/ {
	compatible = "xunlong,orangepi-r1plus\0rockchip,rk332		compatible = "xunlong,orangepi-r1plus\0rockchip,rk332
	interrupt-parent = <0x01>;					interrupt-parent = <0x01>;
	#address-cells = <0x02>;					#address-cells = <0x02>;
	#size-cells = <0x02>;						#size-cells = <0x02>;
	model = "Orange Pi R1 PLUS";					model = "Orange Pi R1 PLUS";

	aliases {							aliases {
		serial0 = "/serial@ff110000";					serial0 = "/serial@ff110000";
		serial1 = "/serial@ff120000";					serial1 = "/serial@ff120000";
		serial2 = "/serial@ff130000";					serial2 = "/serial@ff130000";
							      <
		i2c0 = "/i2c@ff150000";						i2c0 = "/i2c@ff150000";
		i2c1 = "/i2c@ff160000";						i2c1 = "/i2c@ff160000";
		i2c2 = "/i2c@ff170000";						i2c2 = "/i2c@ff170000";
		i2c3 = "/i2c@ff180000";						i2c3 = "/i2c@ff180000";
		**spi0-0 = "/soc/spi@ff190000";		      <**
**		spi0-1 = "/soc/spi@ff190000";		      <**
**		spi0-2 = "/soc/spi@ff190000";		      <**
		ethernet0 = "/ethernet@ff540000";				ethernet0 = "/ethernet@ff540000";
		ethernet1 = "/ethernet@ff550000";				ethernet1 = "/ethernet@ff550000";
		led-boot = "/leds/led-1";					led-boot = "/leds/led-1";
		led-failsafe = "/leds/led-1";					led-failsafe = "/leds/led-1";
		led-running = "/leds/led-1";					led-running = "/leds/led-1";
		led-upgrade = "/leds/led-1";					led-upgrade = "/leds/led-1";
	};								};
**********************************
	******************************************
	spi@ff190000 {							spi@ff190000 {
		compatible = "rockchip,rk3328-spi\0rockchip,r			compatible = "rockchip,rk3328-spi\0rockchip,r
		reg = <0x00 0xff190000 0x00 0x1000>;				reg = <0x00 0xff190000 0x00 0x1000>;
		interrupts = <0x00 0x31 0x04>;					interrupts = <0x00 0x31 0x04>;
		#address-cells = <0x01>;					#address-cells = <0x01>;
		#size-cells = <0x00>;						#size-cells = <0x00>;
		clocks = <0x02 0x20 0x02 0xd1>;					clocks = <0x02 0x20 0x02 0xd1>;
		clock-names = "spiclk\0apb_pclk";				clock-names = "spiclk\0apb_pclk";
		dmas = <0x0b 0x08 0x0b 0x09>;					dmas = <0x0b 0x08 0x0b 0x09>;
		dma-names = "tx\0rx";						dma-names = "tx\0rx";
		pinctrl-names = "default";					pinctrl-names = "default";
		pinctrl-0 = <0x2a 0x2b 0x2c 0x2d>;				pinctrl-0 = <0x2a 0x2b 0x2c 0x2d>;
		status = "okay";			      |			status = "disabled";
							      <
		**flash@0 {				      <**
**				#address-cells = <0x01>;      <**
**				#size-cells = <0x01>;	      <**
**				compatible = "mxicy,mx25l1280 <**
**				reg = <0x00>;		      <**
**				spi-max-frequency = <0x2625a0 <**
**							      <**
**				partitions {		      <**
**					compatible = "fixed-p <**
**					#address-cells = <0x0 <**
**					#size-cells = <0x01>; <**
**							      <**
**					partition@0 {	      <**
**						label = "uboo <**
**						reg = <0x00 0 <**
**					};		      <**
**							      <**
**					partition@80000 {     <**
**						label = "dtb" <**
**						reg = <0x8000 <**
**					};		      <**
**							      <**
**					partition@90000 {     <**
**						compatible =  <**
**						label = "firm <**
**						reg = <0x9000 <**
**					};		      <**
**				};			      <**
**			};				      <**
	};								};


Here is the result it seems works!

root@OpenWrt:/# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00010000 "uboot"
mtd1: 00010000 00010000 "dtb"
mtd2: 00f70000 00010000 "firmware"
root@OpenWrt:/# 

root@OpenWrt:/# cat /dev/mtd2 >> alfa.bin
root@OpenWrt:/# du -sh alfa.bin 
15.5M   alfa.bin
root@OpenWrt:/#

converting dtb to dts

dtc -I dtb -O dts -f rockchip.dtb -o rockchip.dts
dtc -I dts -O dtb -f rockchip.dts -o rockchip.dtb

So i will try to modify uboot any help would be appreciated..

Please refer to this thread: Xunlong Orange Pi R1 Boot from Flash

You'll find the appropriate modifications in the discussions.

As for RK3328 SoC, I will order a 16M SPI flash and test it out in a while, and will post back here.

1 Like

In addition to uboot modification, some openwrt makefile modifications is required along with kernel_config.

Please start fresh with a fork of openwrt upstream.

first of all, SPI partitions in uboot must be added via a patch file, and then in linux dts.

1 Like

Hi,

Thanks for your interest,
3.)
i have edited makefile like shown below and compiled openwrt it gives me 5.9M sysupgrade image

...
...
### Devices ###
define Device/Default
  PROFILES := Default
  KERNEL := kernel-bin | lzma
  IMAGES := sysupgrade.bin
  SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
  DEVICE_DTS = rockchip/$$(SOC)-$(lastword $(subst _, ,$(1)))
  BLOCKSIZE :=64k
  IMAGE_SIZE := 16286k
  IMAGE/sysupgrade.bin = append-kernel | append-rootfs | pad-rootfs | \
  	append-metadata | check-size $$$$(IMAGE_SIZE)
endef

include $(SUBTARGET).mk

$(eval $(call BuildImage))

4.) i have cloned this uboot repo > https://github.com/u-boot/u-boot.git
and added spi booting options to nanopi-r2s-rk3328_defconfig shown below and compiled uboot

CONFIG_SPL=y
CONFIG_CMD_SF=y
CONFIG_CMD_SPI=y
CONFIG_DM_SPI=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_SPI=y
CONFIG_SPI_MEM=y

result images are :u-boot.bin u-boot.cfg u-boot.cfg.configs u-boot.dtb u-boot-dtb.bin u-boot-dtb.img u-boot.img u-boot.itb u-boot.its u-boot.lds

which image should i flash to SPI flash and i don't know below partitioning is true i moved this flash parts from opir1 . Can you help me this point?

root@OpenWrt:/# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00010000 "uboot"
mtd1: 00010000 00010000 "dtb"
mtd2: 00f70000 00010000 "firmware"
root@OpenWrt:/# 

here is modified files by me

https://dosya.co/xrbmuing7vt6/rockchip.dts.html
https://dosya.co/81q0r3lpy90y/nanopi-r2s-rk3328_defconfig.html
https://dosya.co/8ymkcfu632cf/Makefile_sysupgrade_rk.html

1 Like

@alfa I would suggest opening up a new thread for the discussion.

Please post the same in the new created thread.
We will continue the discussion over there.

2 Likes

Hi, we can continue with this thread

1 Like

I have the NanoPi R2S board with me. I will solder a 4MB flash and test out the configurations first.

Meanwhile please wait for input from different users, might be helpful for troubleshooting later.

EDIT: Just found out I only have an 2MB flash. OpenWrt won't fit in here.
Please follow up on the original thread.

1 Like

Check my tutorial and more info about SPI in R2S.

https://github.com/Marcin666/RK3328_Uboot_SPI/

p.12 from your tutorial ...Now write this image idb_finish.img to MMC card and boot NanoPi with this card.
How to write idb_finish.img to SD card ?

dd if=idb_finish.img of=/dev/sdx

or any other way ?

Yes. Exactly this way. Or in Windows use Win32DiskImager.

After that NanoPI does not boot anymore

U-Boot TPL 2023.01-gf58885d0-dirty (Jan 13 2023 - 00:13:57)
DDR4, 333MHz
BW=32 Col=10 Bk=4 BG=2 CS0 Row=15 CS=1 Die BW=16 Size=1024MB
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2023.01-gf58885d0-dirty (Jan 13 2023 - 00:13:57 +0100)
Trying to boot from MMC1
mmc_load_image_raw_sector: mmc block read error
Trying to boot from SPI
Trying to boot from MMC1
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
>### ERROR ### Please RESET the board ###

Can you share Your idb_finish.img so i can check?

Sure.
idb_finish.img and other files are in the zipped file nanopi_rk3328.zip on the turbobit nanopi-rk3328.zip.
Is only one difference between your tutorial and what I have done. In the p. 11 your tutorial you have
export BL31=../arm-trusted-firmware/build/rk3328/release/bl31/bl31.elf

but I have not in my arm-trusted-firmware folder bl31.elf file. Sorry but I do not remember where I found the bl31.elf file, I included it to the zip file.

Did you check my idb_finish.img file ?

Works like a charm

U-Boot TPL 2023.01-gf58885d0-dirty (Jan 24 2023 - 18:35:08)
DDR4, 333MHz
BW=32 Col=10 Bk=4 BG=2 CS0 Row=15 CS=1 Die BW=16 Size=1024MB
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2023.01-gf58885d0-dirty (Jan 24 2023 - 18:35:08 +0100)
Trying to boot from SPI
NOTICE:  BL31: v2.8(release):601e2d4-dirty
NOTICE:  BL31: Built : 17:47:41, Jan 24 2023
NOTICE:  BL31:Rockchip release version: v1.2


U-Boot 2023.01-gf58885d0-dirty (Jan 24 2023 - 18:38:15 +0100)

Model: FriendlyElec NanoPi R2S
DRAM:  1 GiB (effective 1022 MiB)
PMIC:  RK8050 (on=0x40, off=0x01)
Core:  233 devices, 25 uclasses, devicetree: separate
MMC:   mmc@ff500000: 1
Loading Environment from MMC... Card did not respond to voltage select! : -110
*** Warning - No block device, using default environment

Loading Environment from SPIFlash... SF: Detected w25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

In:    serial@ff130000
Out:   serial@ff130000
Err:   serial@ff130000
Model: FriendlyElec NanoPi R2S
Net:   eth0: ethernet@ff540000
Hit any key to stop autoboot:  0
Card did not respond to voltage select! : -110
MMC Device 0 not found
no mmc device at slot 0
starting USB...
Bus usb@ff5c0000: ehci_generic usb@ff5c0000: Failed to get clocks (ret=-19)
Port not available.
Bus usb@ff5d0000: USB OHCI 1.0
Bus usb@ff580000: USB DWC2
scanning bus usb@ff5d0000 for devices... ERROR: CTL:TIMEOUT

Thank you for your hard work

Sorry had no time to responde because of family problems. What you did wrong earlier?