User Tools

Site Tools


Translations of this page:

en:bpi-r4:start

BananaPi R4

Hardware

  • MediaTek MT7988A (Filogic 880)
    • MT7530 switch builtin (1 cpu-port with 4GBit/s + 1Gbit/s user-ports)
  • 4G RAM
  • 8GB eMMC flash
  • 128MB SPI-NAND Flash
  • either 2x SFP+ (10GBit/s USXGMII) or 1SFP+ and 2g5 rj45 with PoE (link)
  • Wifi7 with additional module connected to the 2 PCIe slots at bottom of board
    • BPI-R4-NIC-BE19 (no public sale): MT7996 + MT7975 (2.4G) + MT7977A (6G) + MT7977B (5G)
    • BPI-R4-NIC-BE14: MT7995AV + MT7976CN + MT7977IAN
  • powersupply 12V/5A required when using wifi card,2A (like on other BPi Routers) is not enough

v00:

v1.0:

Changes between v0 and v1 (pm): https://forum.banana-pi.org/t/bpi-r4-linux-bootup/15926/59

v1.1:

thermal

testing fan

by default first trip point is set to 40°C and second is 85°C…for testing the fan it is a bit high when using a passive heatsink. so just set first to 35 and second to 45.

root@bpi-r4-v11:/sys/class/thermal/thermal_zone0
# cat trip_point_4_temp
40000
root@bpi-r4-v11:/sys/class/thermal/thermal_zone0
# cat trip_point_3_temp
85000
root@bpi-r4-v11:/sys/class/thermal/thermal_zone0
# echo 45000 > trip_point_3_temp
root@bpi-r4-v11:/sys/class/thermal/thermal_zone0
# echo 35000 > trip_point_4_temp
root@bpi-r4-v11:/sys/class/thermal/thermal_zone0

Network

GMAC0 (4GBit/s) is connected internally to mt7530 switch variant where the 4 user-Ports are exposed as rj45 on board (1xWan,3xLan).

The SFP(+) cages are connected to SerDes lanes of GMAC1 and GMAC2, and those can be switched between SGMII/1000Base-X/2500Base-X mode for 10M/100M/1000M/2500M (via mtk-pcs-lynxi, just like on MT7622 and MT7986) and USXGMII/10GBase-KR for 5000M and 10000M. Hence it should be possible to support both, SFP modules with 1000M and 2500M, as well as SFP+ modules with 5000M and 10000M.

Sfp-connections

USB-A SFP1-WAN SFP2-LAN 4xRJ-45 12V USB-C
USXGMII0 USXGMII1 GSW
eth2 eth1 eth0

Click to display ⇲

Click to hide ⇱

pm: https://forum.banana-pi.org/t/bpi-r4-linux-bootup/15926/101 (changed interface-names because eth2 is wan-sfp)

full 10G will need RSS+LRO implemented in mtk ethernet driver and enabled (not yet working):

ethtool -K eth2 lro on # enable hw_lro
ethtool -k eth2 | grep large
large-receive-offload: on
iperf3 -bidir -c 192.168.90.10

RSS: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/18f46a84d87308a4f56f9176ca166dc75c38bb20%5E%21/ LRO: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/ddc366751fad05dade79b09932a999c5d5ae890c%5E%21/#F0

NETSYS: V2 for mt7986 (bpi-r3) V3 for mt7988 (bpi-r4)

Wifi

wifi is realized with daughter board (Network Interface Card) in the 2 mPCIe-Slots at bottom of the board.

Wifi-Module needs 12V…v1 uses sw4 in on-position, v0 used devicetree-overlay which enables the WIFI_PWR_EN regulator. Be careful with this setting when using different card in mPCIe slots!

kernel-module: mt7996e.ko

Newer wifi card with reduced antenna-count (6 instead of 14):

https://forum.banana-pi.org/t/banana-pi-bpi-r4-bpi-be14-wi-fi7-nic-module/17182

newer card currently has timeout on 3rd wifi interface (6.8-netnext), i guess we need another firmware file for the mt7977ia frontend

PCIE

2x1Lane (M.2 slots) and 2x2lane. the 2x2lane is for wifi (mPCIe slots).

USB

Bootswitch

A B
nand 0 1
eMMC 1 0
SD 1 1

switch down is “1”, so both down booting from sdcard (v0 had both up to boot from sdcard)

v0:

Click to display ⇲

Click to hide ⇱

  1. both switches up ⇒ sdcard
  2. down (1),up (0) seems to be nand as this have mtd command
  3. up(0),down(1) also boots into bpis bootmenu, but i have no mtd command, so i guess this is the emmc
  4. both down failed

GPIO

eeprom

BPI-R4 has an eeprom on i2c-mux channel 0

[ 1.515672] at24 2-0057: 256 byte 24c02 EEPROM, writable, 1 bytes/write

write-mode (wp-gpio is linked to green led):

# echo 0 > /sys/devices/platform/gpio-leds/leds/green:status/brightness
root@bpi-r4-v11:~
# echo "test" > /sys/bus/i2c/devices/2-0057/eeprom
root@bpi-r4-v11:~
# hexdump -C /sys/bus/i2c/devices/2-0057/eeprom
00000000  74 65 73 74 0a ff ff ff  ff ff ff ff ff ff ff ff  |test............|
00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000100
root@bpi-r4-v11:~
# echo 1 > /sys/devices/platform/gpio-leds/leds/green:status/brightness
root@bpi-r4-v11:~

rtc

TBD

uboot/ATF

currently use these:

and bootup "my" kernel like this:

MT7988> setenv fit 6.5.0-rc1-mt7988.itb
MT7988> setenv kaddr 0x48000000
MT7988> fatload mmc 0:5 ${kaddr} ${fit}
4970220 bytes read in 417 ms (11.4 MiB/s)
MT7988> bootm ${kaddr}

kaddr 0x46000000 works too, if uncompressed kernelimage is smaller than 32M (fit size of 14M was too large)

in newer u-boot i have set kaddr to 0x46000000 (fit loadaddr 0x44000000, rdaddr 0x48000000)

uboot

tftp

BPI-R4> setenv bootfile 6.5.0-rc1-mt7988-r4.itb
BPI-R4> run bootnetfit

openwrt image

using bin/targets/mediatek/filogic/openwrt-mediatek-filogic-bananapi_bpi-r4-initramfs-recovery.itb

BPI-R4> usb start
BPI-R4> ls usb 0:1 r4
            ./
            ../
  7929856   openwrt-mediatek-filogic-bananapi_bpi-r4-initramfs-recovery.itb

1 file(s), 2 dir(s)

BPI-R4> fatload usb 0:1 0x50000000 r4/openwrt-mediatek-filogic-bananapi_bpi-r4-initramfs-recovery.itb
7929856 bytes read in 672 ms (11.3 MiB/s)
BPI-R4> bootm 0x50000000#config-mt7988a-bananapi-bpi-r4#mt7988a-bananapi-bpi-r4-sd

to get the bootconfigs (after #) we can use dumpimage from uboot-tools, see https://www.gibbard.me/linux_fit_images/

linux

https://www.kernel.org/doc/html/v6.1/admin-guide/kernel-parameters.html

3GB Ram limit not needed anymore as ethernet driver now uses 36bit addressing

Click to display ⇲

Click to hide ⇱

Currently we need to limit ram to 3G because of swiotlb buffer full issues in ethernet driver (32bit border)

mem=3G

in cmdline (bootopts in my uboot uEnv.txt)

kernel

debug

# mount -t debugfs none /sys/kernel/debug/
# cat /sys/kernel/debug/gpio
# cat /sys/kernel/debug/pinctrl/pinctrl-handles
# cat /sys/kernel/debug/regulator/regulator_summary
# cat /sys/kernel/debug/clk/clk_summary

#enable debug for driver probe                                                                                     
# echo 'file dd.c +p'>/sys/kernel/debug/dynamic_debug/control                                                                   
# echo 'file core.c +p'>/sys/kernel/debug/dynamic_debug/control 

# echo '11230000.mmc' > /sys/bus/platform/drivers/mtk-msdc/unbind
# echo '11230000.mmc' > /sys/bus/platform/drivers/mtk-msdc/bind

interface config

ip link set lan0 up
ip a a 192.168.0.19/24 dev lan0
ip r a default via 192.168.0.10
date -s "2023-08-23 19:37 CEST"
#stats
ip -s link show dev eth2
ethtool -S eth2

DNS needs to be set in /etc/resolv.conf or in systemd like this:

mkdir -p /etc/systemd/resolved.conf.d/ 
cp /etc/systemd/resolved.conf /etc/systemd/resolved.conf.d/TEST.conf
echo "DNS = 192.168.0.10" >> /etc/systemd/resolved.conf.d/TEST.conf
systemctl restart systemd-resolved.service 

modules in initrd:

mount /dev/mmcblk0p6 /mnt
mkdir /lib/modules
mkdir /lib/firmware
mount -o bind /mnt/lib/modules /lib/modules
mount -o bind /mnt/lib/firmware /lib/firmware
modprobe mt7996e

openwrt

upstream

same as for r3

https://forum.banana-pi.org/t/banana-pi-r3-bsp-source-code/14257/2

but select BananaPi BPI-R4 of course :)

i had to do a “make distclean” after “git pull” followed by the documented steps

# Update the feeds
./scripts/feeds update -a
./scripts/feeds install -a

make menuconfig
#select "Target System (MediaTek Ralink ARM)" => "Subtarget (Filogic 8x0 (MT798x))" => "Target Profile (Bananapi BPi-R4)"
make -j$(nproc)

then write the sdcard image…

gunzip -c bin/targets/mediatek/filogic/openwrt-mediatek-filogic-bananapi_bpi-r4-sdcard.img.gz | sudo dd bs=1M status=progress conv=notrunc,fsync of=/dev/sdX

downstream (sdk)

  • clone openwrt master
  • add this to feeds.conf.default: “src-git mtksdk https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds
  • scripts/feeds update -f mtksdk
  • make menuconfig:
    • Target System (MediaTek Ralink ARM)
    • Subtarget (Filogic 8×0 (MT798x))
    • Target Profile (MediaTek MT7988a nand rfb) #here i see no sd-variant

adding additional options:

CONFIG_PACKAGE_f2fs-tools=y
CONFIG_PACKAGE_e2fsprogs=y
CONFIG_PACKAGE_dosfstools=y
CONFIG_PACKAGE_resize2fs=y
CONFIG_PACKAGE_nano=y
CONFIG_PACKAGE_iperf3=y
#CONFIG_PACKAGE_netcat
CONFIG_PACKAGE_tcpdump=y
CONFIG_BUSYBOX_CUSTOM=y
CONFIG_BUSYBOX_CONFIG_TELNET=y
*-initramfs-kernel.bin is not the production image we’re using. We only use it for testing purpose since it contains rootfs and won’t read the flash.
*-sysupgrade.bin is the actual production image. It’s a tar ball for nand/emmc/sd boards. It contains separate kernel and rootfs that will be written to ubi volume for nand, or the partitions defined for sd/emmc.
tar -xf bin/targets/mediatek/filogic/openwrt-mediatek-filogic-mediatek_mt7988a-rfb-nand-squashfs-sysupgrade.bin sysupgrade-mediatek_mt7988a-rfb-nand/kernel
dumpimage -l sysupgrade-mediatek_mt7988a-rfb-nand/kernel

tftpboot 0x50000000 openwrt-mediatek-filogic-bananapi_bpi-r4-initramfs-recovery.itb
bootm 0x50000000#config-mt7988a-bananapi-bpi-r4#mt7988a-bananapi-bpi-r4-sd

Known Issues

en/bpi-r4/start.txt · Last modified: 2024/04/21 13:26 by frank