Getting Started with BPI-R3 MINI

From Banana Pi Wiki
Revision as of 18:07, 30 January 2024 by Sinovoip (talk | contribs) (iperf3 test)
Jump to: navigation, search

Introduction

Banana Pi BPI-R3 Mini Router board with MediaTek MT7986A(Filogic 830) quad core ARM A53 chip design ,2G DDR RAM ,8G eMMC flash onboard,It is a very high performance open source router development board,support Wi-Fi6 2.4G/5G with MT7976C, support 2x 2.5GbE ethernet port.

MediaTek MT7986(Filogic 830)

The MT7986(Filogic 830) integrates four Arm Cortex-A53 cores up to 2GHz with up to 18,000 DMIPs of processing power and 6Gbps of dual 4x4 Wi-Fi6 connectivity. It has two 2.5g Ethernet interfaces and serial peripheral interfaces (SPI). Filogic 830‘s built-in hardware acceleration engine enables fast and reliable Wi-Fi offloading and wireless network connection. In addition, the chip supports Mediatek FastPath™ technology, which is suitable for games, AR/VR and other low-latency applications.

Wi-fi 6 has many advantages over its predecessors, including lower latency, larger bandwidth capacity and faster transmission rates. Wireless network devices supporting the 6GHz band mainly use 160MHz wide channel and 6GHz uncongested bandwidth to provide multigigabit transmission and low-latency wi-fi connection, providing reliable wireless network for streaming media, games, AR/VR and other applications.

Key Features

  • MediaTek MT7986A(Filogic 830) Quad core ARM Cortex A53
  • Wifi 6 2.4G/5G(MT7976C)
  • 2G DDR RAM
  • 8G eMMC flash
  • 128MB Nand flash
  • 2x 2.5GbE Ethernet port
  • 1x M.2 Key B USB inerface
  • 1x M.2 KEY M PCIe inerface
  • 1x USB2.0 interface

Development

Basic Development

Prepare to develop

 * Prepare USB-Serial interface
 * Using your USB-Serial Connect debug console on BPI-R3 MINI
  Note: Debug Uart 3.3v TTL,Baud: 115200.
 * Default IP address for LAN port: 192.168.1.1
 * User name/password: pi/bananapi ,root/bananapi.
 Or the user is root without a password.
 * WIFI: Operwrt

 BPI-R3-MINI-Back.png
 *R3mini boot switch Jumper Setting
  Note: EMMC Boot or Nand boot Support.

Warnning

 Note: Because BPI-R3 MINI can't support that it boot from SD, So the factory will flash one default image into Nand and EMMC Device. 
 Anytime please confirm that one EMMC or Nand device include one bootable image, it's very important!!
 If there is no OS in the memory, the consol port will print "System halt!" and sotp running.
 At this time, you need to switch to another memory to boot from.
 SYSHalt.png
 if you want to update EMMC device, please boot from Nand
 R3mini NANDBOOT2.png
 otherwise you update Nand device when it boot from EMMC.
 R3mini eMMCBOOT.png


How to burn image to onboard eMMC

 Note: when you want to Update EMMC device, Firstly Change boot switch to boot from Nand device, then after boot up,you need flash one emmc image into EMMC device. Finally you change bootstrap to boot from EMMC.
 Before burning image to eMMC, please prepare a USB disk. Let's take OpenWrt image (mtk-bpi-r3mini-EMMC-20230719.img, bl2_emmc-r3mini.img) for example, the steps are below:
 1. Copy EMMC boot OpenWrt image(mtk-bpi-r3mini-EMMC-20230719.img, bl2_emmc.img) to USB disk.
 
 2. Change boot switch Jumper, the board boot from Nand device, then power up the board.
 
 3. Plug in USB disk to the board, and mount the USB to /mnt or other directory as follows: (you can skip mounting if it is mounted automatically)
    * mount -t vfat /dev/sda1 /mnt 
    * change your directory to the mounting point, here is : cd /mnt
 4. Execute following command to enable and copy image to EMMC device:
    * echo 0 > /sys/block/mmcblk0boot0/force_ro
    * dd if=bl2_emmc-r3mini.img of=/dev/mmcblk0boot0
    * dd if=mtk-bpi-r3mini-EMMC-20230719.img of=/dev/mmcblk0
    * mmc bootpart enable 1 1 /dev/mmcblk0
 5. power off R3MINI board, remove u-disk driver, change bootstrap to boot from emmc device.
    Note: Enable EMMC device, boot strap is from EMMC.

How to burn image to onboard Nand

 Note: when you want to Update Nand device, Firstly Change boot switch to boot from EMMC device, then after boot up,you need flash one nand image into nand device. Finally you change bootstrap to boot from Nand device.
 Before burning image into Nand, please prepare a USB disk. Let's take OpenWrt image (mtk-bpi-r3mini-NAND-20230719-single-image.bin) for example, the steps are below:
 1. Copy Nand boot OpenWrt image(mtk-bpi-r3mini-NAND-20230719-single-image.bin) to USB disk.
 
 2. Change boot switch Jumper, the board boot from EMMC device, then power up the board.
 
 3. Plug in USB disk to the board, and mount the USB to /mnt or other directory as follows: (you can skip mounting if it is mounted automatically)
    * mount -t vfat /dev/sda1 /mnt 
    * change your directory to the mounting point, here is : cd /mnt
 4. Execute following command to erase the whole Nand flash and copy image to nand device:
    * mtd erase /dev/mtd0
    * dd if=mtk-bpi-r3mini-NAND-20230719-single-image.bin of=/dev/mtdblock0
 5. power off BPI-R3 MINI board, remove u-disk driver, change bootstrap to boot from Nand device.
    Note: Enable Nand device, boot strap is from Nand.

Network-Configuration

BPI-R3 MINI interface.jpg

root@OpenWrt:/# ifconfig

br-lan Link encap:Ethernet HWaddr EE:A1:57:81:CA:19

         inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
         inet6 addr: fe80::eca1:57ff:fe81:ca19/64 Scope:Link
         inet6 addr: fd63:8bea:d5ce::1/60 Scope:Global
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 B)  TX bytes:2418 (2.3 KiB)

br-wan Link encap:Ethernet HWaddr EE:A1:57:81:CA:19

         inet6 addr: fe80::eca1:57ff:fe81:ca19/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 B)  TX bytes:8538 (8.3 KiB)

eth0 Link encap:Ethernet HWaddr EE:A1:57:81:CA:19

         inet6 addr: fe80::eca1:57ff:fe81:ca19/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 B)  TX bytes:4408 (4.3 KiB)
         Interrupt:124

eth1 Link encap:Ethernet HWaddr 4A:BB:84:B4:5D:3F

         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 B)  TX bytes:8674 (8.4 KiB)
         Interrupt:124

lo Link encap:Local Loopback

         inet addr:127.0.0.1  Mask:255.0.0.0
         inet6 addr: ::1/128 Scope:Host
         UP LOOPBACK RUNNING  MTU:65536  Metric:1
         RX packets:56 errors:0 dropped:0 overruns:0 frame:0
         TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:4368 (4.2 KiB)  TX bytes:4368 (4.2 KiB)

ra0 Link encap:Ethernet HWaddr 00:0C:43:26:60:38

         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
         Interrupt:6

rax0 Link encap:Ethernet HWaddr 02:0C:43:36:60:38

         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@OpenWrt:/# brctl show br-wan

bridge name bridge id STP enabled interfaces br-wan 7fff.eea15781ca19 no eth1

root@OpenWrt:/# brctl show br-lan

bridge name bridge id STP enabled interfaces br-lan 7fff.eea15781ca19 no eth0, rax0, ra0, apclix0, apcli0

root@OpenWrt:/#


iperf3 test

R3mini-case-wanlanA.png


2.5G Ethernet:

R3miniA(WAN)---| |
|2.5G switch |---Ethernet
R3miniB(WAN)---| |
R3miniA <-------iperf3------> R3miniB
R3mini-iperf3-WAN.png


                    R3miniA(WAN)---|            |
                                   |2.5G switch |---Ethernet      
R3miniC(WAN)---(LAN)R3miniB(WAN)---|            |
R3miniC <-------iperf3------> R3miniA       
 R3mini-iperf3-Switch.png


5GWi-Fi:

iPhone 5Gwifi <-------iperf3------> (Wi-Fi) BPI-R3mini

Note: The distance between iPhone and R3mini is about one meter.

R3mini-WiFiTestA.png

Advanced Development

GPIO Control

  • echo xxx > /sys/class/gpio/export
  • echo in/out > /sys/class/gpio/gpioxxx/direction
  • echo 0/1 > /sys/class/gpio/gpioxxx/value

Check the base gpio, you could see mine is 411

BPI-R3-GPIO-Base.jpg

For example: if you want to change gpio 22 as out highlevel, you need input commands like this:

  • echo 433(22+411) > /sys/class/gpio/export
  • echo out > /sys/class/gpio/gpio433/direction
  • echo 1 > /sys/class/gpio/gpio433/value

FAN

R3mini-FAN-CON.png

  • CN16 is a 1.25 pitch 3PIN socket, used to connect the fan, supports PWM control.

PWM FAN Control

  • echo 0 > /sys/class/pwm/pwmchip0/export
  • echo 10000 > /sys/class/pwm/pwmchip0/pwm0/period
  • echo 5000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
  • echo normal > /sys/class/pwm/pwmchip0/pwm0/polarity
  • echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable

M.2 KEY B slot

currently, M.2 KEY B slot only support USB 4G/5G module, example: Quectel RM500U-CN or RM520N-GL

when you install one 4G/5G module, you may check it.

R3mini-RM500U-1000.png

4G/5G Module

BPI-R3mini supports M.2 KEYB USB interface Cellular network module: 4G LTE EM05, 5G Quectel RM500U-CN/RG200U-CN and RM520N-GL/RM500Q-GL Series.

The released image(2023-11-15 or later) default driver is RM500U-CN and RM520N-GL, Install one of these two modules and you can use it directly.

If use EM05 or others,you will most likely need to modify the driver.

Note: The availability of 4G/5G depends on the local carrier frequency band.

Wi-Fi Ap mode on BPI-R3mini

  • ra0 is MT7986a 2.4G wifi
  • rax0 is MT7986a 5G wifi

Serial cable

Because the UART0_TXD of the debug port is also a wifi strap pin, this pin needs to be pull-low when poweron,

some serial cable have strong pull-up, such as PL2303,if it is inserted before powering on, it will cause the wifi chip to be recognized incorrectly, and the wifi function will fail.

Other types including cp2102,ch340 and FDTI are all available, serial cable power domian must be 3.3v TTL standard.

You can buy the serial cable here: https://www.aliexpress.us/item/3256805457599756.html?


R3mini-USBC2UART.png

If your computer has a USB TypeC connector and supports PD12V/1.5A (20W) or above, you can also directly use the computer to power BPI-R3mini.

Moreover, since BPI-R3mini has built-in USB to serial port chip CH340E, you do not need to use additional serial cables.

NOTE:If your computer does not support USB PD, then the R3mini will most likely keep restarting.

Because the power consumption of R3mini is relatively large (all peripherals are plugged in and the power consumption is close to 20W when running)

FAQ

  • MT7986a Reference Manual for Develope Board(BPi)
Google Drive:https://drive.google.com/file/d/1biSJmxnIpNzQroYDg9mtPtSTAv4i0DFf/view?usp=sharing

TTL Voltage

The debug uart is 3.3V TTL power domain.

Reference Link

http://forum.banana-pi.org/