Difference between revisions of "Getting Started with BPI-R3"

From Banana Pi Wiki
Jump to: navigation, search
(Introduction)
(Prepare to develop)
 
(82 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[zh:快速上手 香蕉派 BPI-R64]]
+
[[zh:快速上手 香蕉派 BPI-R3]]
=Introduction=
+
==Introduction==
[[File:Banana_Pi_BPI-R64_1.jpg|thumb|Overview:[[Banana Pi BPI-R3]]]]
+
 
[[File:BPI-R64_case_1.jpg|thumb|[[Banana Pi BPI-R64]] Metal Jacket]]
+
Banana Pi BPI-R3 Mini Router board with MediaTek MT7986(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 wifi use MT7975N and 5G wifi use MT7975P, support 2 2.5GbE network port.
[[File:BPI-R64_PoE.JPG|thumb|BPI-R64 with BPI-7402 POE function support]]
+
 
[[File:BPI-7402_IEEE_802.3at_PoE_module_1.jpg|thumb|[[BPI-7402 IEEE 802.3at PoE module]]]]
+
==MediaTek MT7986(Filogic 830)==
[[File:5G_gateway_2.jpg|thumb|BPI:4.0 [[Successful case]] 5G Converged communication gateway]]
+
 
[[File:Banana_pi_BPI-R1_1.JPG|thumb|[[Banana Pi BPI-R1]] Allwinner A20]]
+
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.
[[File:BPI-R2_3.JPG|thumb|[[Banana Pi BPI-R2]] with MTK MT7623N chip design]]
+
 
[[File:Banana_Pi_BPI-R2_Pro_1_750.jpg|thumb|[[Banana Pi BPI-R2 Pro]] Rockchip RK3568 design]]
+
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.
[[File:O2A0500.jpg|thumb|[[Banana Pi BPI-W2]] with Realtek RTD1296 chip design]]
 
[[File:Banana_Pi_BPI-R3_Router_2.jpg|thumb|[[Banana Pi BPI-R3]] with MediaTek MT7986(Filogic 830)]]
 
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D chip]]
 
  The Banana Pi R64 is a router based development board, which can run on a variety of open source operating systems including OpenWrt,Linux. It has 4 Gigabit LAN ports, 1 Gigabit WAN, and AC wifi AP function. use 64 bit chip design.
 
Read more: [[Banana Pi BPI-R64]]
 
  
 
==Key Features==
 
==Key Features==
  
* MediaTek MT7622,1.35GHZ 64 bit dual-core ARM Cortex-A53
+
* MediaTek MT7986(Filogic 830) Quad core ARM Cortex A53
* 1G DDR3 SDRAM
+
* Wifi 6 2.4G/5G(MT7976C)
* Mini PCIE interface support 4G module
+
* 2G DDR RAM
* Built-in 4x4n 802.11n/Bluetooth 5.0 system-on-chip
+
* 8G eMMC flash
* MTK7615 4x4ac wifi on board
+
* 128MB Nand flash
* Support 1 SATA interface
+
* 2x 2.5GbE network port
* MicroSD slot supports up to 256GB expansion
+
* 1x M.2 Key B USB inerface
* 8G eMMC flash (option 16/32/64G)
+
* 1x M.2 KEY M PCIe inerface
* 5 port 10/100/1000 Mb Ethernet port
+
* 1x USB2.0 interface
* 1 Port USB 3.0
 
* Slow I/O:ADC, Audio Amplifier, GPIO, I2C, I2S, IR, PMIC I/F, PWM, RTC, SPI, UART
 
* POE function support
 
  
 
=Development=
 
=Development=
Line 34: Line 26:
 
===Prepare to develop===
 
===Prepare to develop===
 
   * Prepare 8G/above TF card, USB-Serial interface, Ubuntu System
 
   * Prepare 8G/above TF card, USB-Serial interface, Ubuntu System
   * Using your USB-Serial Connect debug console on R64
+
   * Using your USB-Serial Connect debug console on BPI-R3
 +
  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: '''MTK_MT7986_AP_AX6000_2.4G'''and'''MTK_MT7986_AP_AX6000_5G'''
 +
  [[Image:R3_debug_console.jpg|320px]]
  
   [[Image:R64_debug_console.jpg|320px]]
+
  * R3 bootstrap and device select Jumper Setting
 +
   [[Image:BPI-R3-Jumper.png|320px]]
 +
 
 +
  Note: SW1-A and SW1-B is for boot strap selecting;
 +
        SW1-C is that SPI-Nand or SPI-Nor Device is connected to CPU's SPI bus;
 +
        SW1-D is that SD Card or EMMC device is connected tp CPU's EMMC bus.
 +
 +
  * Examples:
 +
    All Jumper is High.
 +
    [[Image:BPI-R3-Jumper-ALL-High.png|320px]]
 +
 
 +
    All Jumper is Low.
 +
    [[Image:BPI-R3-Jumper-ALL-Low.png|320px]]
  
 
===How to burn image to SD card===
 
===How to burn image to SD card===
   1.You could download latest image from our forum
+
   A. Note: burn image to SD card on linux computer
  * Here is the example image link:  
+
    1.You could download latest image from our forum
 +
    * Here is the example image link:  
 
    
 
    
  2.Install bpi-tools on your Ubuntu. If you can't access this URL or any other problems, please go to [https://github.com/BPI-SINOVOIP/bpi-tools bpi-tools repo] and install this tools manually.
+
    2.Install bpi-tools on your Ubuntu. If you can't access this URL or any other problems, please go to [https://github.com/BPI-SINOVOIP/bpi-tools bpi-tools repo] and install this tools manually.
  * apt-get install pv
+
    * apt-get install pv
  * curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash
+
    * curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash
 
    
 
    
  3.After you download the image, insert your TF card into your Ubuntu
+
    3.After you download the image, insert your TF card into your Ubuntu
  * Execute "bpi-copy xxx.img /dev/sdx" to install image on your TF card
+
    * Execute "bpi-copy xxx.img /dev/sdx" to install image on your TF card
 
    
 
    
  4.After step 3, then you can insert your TF card into R64, and press power button to setup R64
+
    4.After step 3, then you can insert your TF card into R3, and press power button to setup R3
 +
  B. Note: burn image to SD card on windows computer
 +
    1. Download the tools from the website:  https://sourceforge.net/projects/win32diskimager/
 +
    2. Install the tools into Windows computer.
 +
    3. flash image into SD card.
 +
 
 +
C. Change Boot Jumper to boot from SD, Enable SD Card Device.
 +
    [[Image:BPI-R3-Jumper-ALL-High.png|320px]]
  
====How to burn image to onboard eMMC====
+
===How to burn image to onboard eMMC===
   Before burning image to eMMC, please prepare a SD card with flashed bootable image and a USB disk. Let's take OpenWrt image (mtk-bpi-r64-preloader-emmc.bin,2020-04-09-OpenWRT-mtk-bpi-r64-EMMC.img) for example, the steps are below:
+
   Note: because SD card and EMMC device share one SOC's interface, you need flash one SD image firstly, then R3 boot from SD card, then flash nand image into Nand, then change boot strap to boot from nand,  you need flash EMMC image into EMMC. Finally you change bootstrap to boot from EMMC.
  
   1. Insert the flashed SD card and power on to start the board.(the image on the SD card can be OpenWrt or other linux OS like ubuntu...)
+
   Before burning image to eMMC, please prepare a SD card with flashed bootable image and a USB disk. Let's take OpenWrt image (mtk-bpi-r3-SD-WAN1-SFP1-20220619-single-image.img, mtk-bpi-r3-NAND-WAN1-SFP1-20220619-single-image.bin, bl2_emmc.img, mtk-bpi-r3-EMMC-WAN1-SFP1-20220619-single-image.img) for example, the steps are below:
  
   2. Copy eMMC bootable OpenWrt image(mtk-bpi-r64-preloader-emmc.bin,2020-04-09-OpenWRT-mtk-bpi-r64-EMMC.img) to USB disk, if the image is compressed please uncompress it before copying to USB disk.
+
  1. Insert the flashed SD card and power on to start the board.(the image "mtk-bpi-r3-SD-WAN1-SFP1-20220619-single-image.img" on the SD card can be OpenWrt or other linux OS like ubuntu...)
 +
 
 +
   2. Copy Nand bootable and EMMC boot OpenWrt image(mtk-bpi-r3-NAND-WAN1-SFP1-20220619-single-image.bin, bl2_emmc.img, mtk-bpi-r3-EMMC-WAN1-SFP1-20220619-single-image.img) to USB disk, if the image is compressed please uncompress it before copying to USB disk.
  
 
   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)
 
   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)
Line 62: Line 82:
 
     * change your directory to the mounting point, here is : cd /mnt
 
     * change your directory to the mounting point, here is : cd /mnt
  
   4. Execute following command to enable and copy image to eMMC:
+
   4. Execute following command to enable and copy image to nand flash:
 +
    * mtd erase /dev/mtd0
 +
    * dd if=mtk-bpi-r3-NAND-WAN1-SFP1-20220619-single-image.bin of=/dev/mtdblock0
 +
 
 +
  5. Shutdown, remove SD card, and change bootstrap to boot from nand flash and change SD/EMMC switch jumper to EMMC, restart the board from Nand Flash.
 +
    Note: Enable EMMC device, boot strap is from nand
 +
    [[Image:BPI-R3-Jumper-Flash-EMMC.png|320px]]
 +
 
 +
  6. repeat step 3, mount u-disk to /mnt, Execute following command to enable and copy image to EMMC device:
 +
    * mount -t vfat /dev/sda1 /mnt
 
     * echo 0 > /sys/block/mmcblk0boot0/force_ro
 
     * echo 0 > /sys/block/mmcblk0boot0/force_ro
     * dd if=2020-04-09-OpenWRT-mtk-bpi-r64-EMMC.img of=/dev/mmcblk0
+
     * dd if=bl2_emmc.img of=/dev/mmcblk0boot0
     * dd if=mtk-bpi-r64-preloader-emmc.bin of=/dev/mmcblk0boot0
+
     * dd if=mtk-bpi-r3-EMMC-WAN1-SFP1-20220619-single-image.img of=/dev/mmcblk0
     * mmc bootpart enable 1 1   /dev/mmcblk0
+
     * mmc bootpart enable 1 1 /dev/mmcblk0
  
   5. Shutdown, remove SD card and USB disk, and restart the board from eMMC.
+
   7. power off R3 board, remove u-disk driver, change bootstrap to boot from emmc device.
 +
    Note: Enable EMMC device, boot strap is from EMMC.
 +
    [[Image:BPI-R3-Jumper-Boot-EMMC.png|320px]]
  
 
=== Network-Configuration===
 
=== Network-Configuration===
*Network-Configuration : http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:network:start
+
*Network-Configuration refer to: http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:network:start
 +
*Network Interface: eth1, lan0 is for WAN; lan4, rax0, lan2, lan5, ra0, lan3, lan1 is for LAN,  ra0 is for 2.4G wireless, rax0 is for 5G wireless.
  
==Advanced Development==
+
[[Image:BPI-R3_network_interface.jpg|640px]]
===GPIO===
 
====40 Pins Definition====
 
  
[[Image:R64_gpio_40.jpg]]
+
root@OpenWrt:/# ifconfig
  
====GPIO Control====
+
br-lan    Link encap:Ethernet  HWaddr EE:A1:57:81:CA:19
* echo xxx > /sys/class/gpio/export
+
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
* echo in/out > /sys/class/gpio/gpioxxx/direction
+
          inet6 addr: fe80::eca1:57ff:fe81:ca19/64 Scope:Link
* echo 0/1 > /sys/class/gpio/gpioxxx/value
+
          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)
  
Check the base gpio, you could see mine is 409
+
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)
  
[[Image:R64_gpio_base.jpg]]
+
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
  
For example: if you want to change gpio 22 as out highlevel, you need input commands like this:
+
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
  
* echo 431(22+409) > /sys/class/gpio/export
+
lan0      Link encap:Ethernet  HWaddr EE:A1:57:81:CA:19
* echo out > /sys/class/gpio/gpio431/direction
+
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
* echo 1 > /sys/class/gpio/gpio431/value
+
          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)
  
====PWM Control====
+
lan1      Link encap:Ethernet  HWaddr EE:A1:57:81:CA:19
* echo x >/sys/class/pwm/pwmchip0/export
+
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
* echo 200000 >/sys/class/pwm/pwmchip0/pwmx/period
+
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
* echo 100000 >/sys/class/pwm/pwmchip0/pwmx/duty_cycle                                                                   
+
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
* echo 1 >/sys/class/pwm/pwmchip0/pwmx/enable
+
          collisions:0 txqueuelen:1000
 +
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
  
====SPI touch panel====
+
lan2      Link encap:Ethernet  HWaddr EE:A1:57:81:CA:19
SPI Panel module:
+
          UP BROADCAST 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)
  
2.4" Touch Screen TFT LCD with SPI Interface, 240x320 (ILI9341 + ADS7843/XPT2046/HR2046)
+
lan3      Link encap:Ethernet  HWaddr EE:A1:57:81:CA:19
 +
          UP BROADCAST 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)
  
SPI Panel <–> BPIR64
+
lan4      Link encap:Ethernet  HWaddr EE:A1:57:81:CA:19
 +
          UP BROADCAST 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)
  
  T_DO, T_DIN, T_CLK <–> SPIC_0: MOSI / MISO / CLK
+
lan5      Link encap:Ethernet HWaddr EE:A1:57:81:CA:19
  T_CS <–> SPI-CE0
+
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  T_IRQ <–> IO-37
+
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
SDO, SCK, SDI <–> SPIC_1: MOSI / MISO / CLK
+
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
LED <–> PIN-31
+
          collisions:0 txqueuelen:1000
DC <–> PIN-11
+
          RX bytes:0 (0.0 B) TX bytes:2418 (2.3 KiB)
  RESET <–> PIN-13
 
CS <–> SPI-CE1
 
GND <–> GND-9
 
VCC <–> 3.3V-1
 
  
DTS Modification:
+
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
        backlight: backlight {
+
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                compatible = "gpio-backlight";
+
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                gpios = <&pio 82 GPIO_ACTIVE_HIGH>;        //PIN31 IO-31 : GPIO82
+
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                default-on;
+
          collisions:0 txqueuelen:1000
        };
+
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
};
+
          Interrupt:6
  
  &pio {
+
rax0      Link encap:Ethernet HWaddr 02:0C:43:36:60:38
        spic0_pins: spic0-pins {
+
          UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1
                mux {
+
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                        function = "spi";
+
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                        groups = "spic0_0";
+
          collisions:0 txqueuelen:1000
                };
+
          RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
        };
 
   
 
        spic1_pins: spic1-pins {
 
                mux {
 
                        function = "spi";
 
                        groups = "spic1_0";
 
                };
 
        };
 
  }
 
  
&spi0 {
+
root@OpenWrt:/# brctl show br-wan
        pinctrl-names = "default";
 
        pinctrl-0 = <&spic0_pins>;
 
        status = "okay";
 
        touch@0 {
 
                reg = <0>;                                //CE0
 
                compatible = "ti,ads7843";
 
                interrupt-parent = <&pio>;
 
                interrupts = <86 0>;                      //PIN37: IO-37 == GPIO86
 
                pendown-gpio = <&pio 86 0>;
 
                spi-max-frequency = <1000000>;
 
                vcc-supply = <&reg_3p3v>;
 
                wakeup-source;
 
        };
 
};
 
  
&spi1 {
+
bridge name    bridge id              STP enabled    interfaces
        pinctrl-names = "default";
+
br-wan          7fff.eea15781ca19      no              lan0, eth1
        pinctrl-0 = <&spic1_pins>;
 
        status = "okay";
 
        display@0{
 
                compatible = "ilitek,ili9341";
 
                reg = <0>;                                //CE0
 
                spi-max-frequency = <32000000>;
 
                dc-gpios = <&pio 51 GPIO_ACTIVE_HIGH>;    //PIN11 UART1-TXD : GPIO51
 
                reset-gpios = <&pio 52 GPIO_ACTIVE_HIGH>;  //PIN13 UART1-RXD : GPIO52
 
                backlight = <&backlight>;
 
        };
 
};
 
  
Kernel config:
+
root@OpenWrt:/# brctl show br-lan
  
+CONFIG_FB_TFT_ILI9341
+
bridge name    bridge id              STP enabled    interfaces
+CONFIG_FB_TFT
+
br-lan          7fff.eea15781ca19      no              lan4, rax0, lan2, lan5, ra0, lan3, lan1
+CONFIG_FB
 
+CONFIG_BACKLIGHT_LCD_SUPPORT
 
+CONFIG_BACKLIGHT_CLASS_DEVICE
 
+CONFIG_BACKLIGHT_GPIO
 
+CONFIG_INPUT
 
+CONFIG_INPUT_TOUCHSCREEN
 
+CONFIG_TOUCHSCREEN_ADS7846
 
  
Application:
+
root@OpenWrt:/#
  
{| class="wikitable"
+
==Advanced Development==
|-
+
===GPIO===
| Package  ||+ Description  || Source 
+
====26 Pins Definition====
|-
 
|  fbv ||  framebuffer image viewer  ||  https://github.com/godspeed1989/fbv
 
|-
 
| input-event-daemon  ||  input-event-daemon with touchTEST event ||  https://github.com/SAM33/input-event-daemon
 
|-
 
|}
 
  
input-event-daemon config that show image by touch area:
+
[[Image:R3_gpio_40.jpg]]
(I don't know why are the coordinates so strange, but the result of my actual touch and
 
print out that it is like this)
 
  
[Global]
+
====GPIO Control====
listen = /dev/input/event0
+
* echo xxx > /sys/class/gpio/export
listen = /dev/input/event1
+
* echo in/out > /sys/class/gpio/gpioxxx/direction
[TouchTEST]
+
* echo 0/1 > /sys/class/gpio/gpioxxx/value
340,400,3440,1860 = cat /dev/zero > /dev/fb0; fbv -f /root/bpi_608x429.jpg -s 1
 
340,2260,3440,1860 = cat /dev/zero > /dev/fb0; fbv -f /root/openwrt_449x449.png -s 1
 
  
Banana Pi BPI-R64 SPI touch panel test: https://www.youtube.com/watch?v=ikag-D_TI0g&feature=youtu.be
+
Check the base gpio, you could see mine is 411
  
===Sata===
+
[[Image:BPI-R3-GPIO-Base.jpg]]
* '''If you want to use Sata interface on R64, you need to give GPIO90 low level'''
 
** echo 499 > /sys/class/gpio/export
 
** echo out > /sys/class/gpio/gpio499/direction
 
** echo 0 > /sys/class/gpio/gpio499/value
 
  
*Test a TOSHIBA HDD DISK, the Read/Write performance are below:
+
For example: if you want to change gpio 22 as out highlevel, you need input commands like this:
 
 
::Read from disk: 50MB/s command: dd if=/dev/sda of=/dev/null bs=1M count=1024
 
 
 
::Write to disk: 38MB/s  command: dd if=/dev/zero of=/dev/sda bs=1M count=1024
 
[[Image:R64_hdd_sata_test.jpg]]
 
 
 
*Test a SAMSUNG SSD DISK, the Read/Write performance are below:
 
 
 
::Read from disk: 360MB/s command: dd if=/dev/sda of=/dev/null bs=1M count=1024
 
 
 
::Write to disk:  200MB/s command: dd if=/dev/zero of=/dev/sda bs=1M count=1024
 
[[Image:R64_ssd_sata_test.jpg]]
 
 
 
===PCIe===
 
* '''If you want to use PCIe interface on R64, you need to give GPIO90 high level'''
 
** echo 499 > /sys/class/gpio/export
 
** echo out > /sys/class/gpio/gpio499/direction
 
** echo 1 > /sys/class/gpio/gpio499/value
 
 
 
* PCIe supports EC-25 4G module.
 
[[Image:R64_pcie_test_1.jpg]]
 
 
 
[[Image:R64_pcie_test_2.jpg]]
 
 
 
===GMAC===
 
Use iperf3 to test gmac
 
 
 
1. On PC Terminal:
 
* Execute "iperf3 -s"
 
 
 
2. On R64 console:
 
* TCP test: "iperf3 -c serverIP"
 
* UDP test: "iperf3 -u -c serverIP"
 
[[Image:R64_Gmac_test.jpg]]
 
 
 
===BT & BLE on R64===
 
'''R64 BT Architectural'''
 
 
 
[[Image:R64_BT_Arch.jpg]]
 
 
 
* BLE on R64
 
* Input Command "btmw-test", you will enter to "btmw_test_cli" command line
 
 
 
[[Image:R64_BT_cli.jpg]]
 
 
 
* Here are some example commands:
 
** MW_GAP name 7622_BT /*rename bt device*/
 
** MW_GAP info        /*check local BT device info*/
 
** MW_GATTC scan      /* start ble scan*/
 
** MW_GATTC stop_scan  /* stop ble scan*/
 
 
 
===R64 LAN Function===
 
* LAN eth interface is eth2, use "ifconfig eth2 up" to enable it.
 
* Config the ip, "ifconfig eth2 192.168.1.1".
 
  [[Image:R64_Lan_test_1.jpg]]
 
  
* Config your dhcp server, "vim /etc/dhcp/dhcpd.conf", add these configurations.
+
* echo 433(22+411) > /sys/class/gpio/export
  [[Image:R64_Lan_test_2.jpg]]
+
* echo out > /sys/class/gpio/gpio433/direction
 +
* echo 1 > /sys/class/gpio/gpio433/value
  
* Start dhcp server, "dhcpd eth2".
+
===FAN===
  [[Image:R64_Lan_test_3.jpg]]
 
  
* then config iptables and set package forward.
+
[[Image:FAN.png]]
** Add "net.ipv4.ip_forward=1" to "/etc/sysctl.conf"
 
** "/sbin/sysctl -p" to make forward work
 
** "iptables -t nat -A POSTROUTING -s 192.168.1.1/24 -o eth3 -j MASQUERADE"
 
  
===Ap mode on R64===
+
* R317 for 5V FAN and R318 for 12V FAN.
* Find "mt_wifi.ko" and insmod it.
+
* CN23 supports PWM control while CN22 does not support.
** insmod ./lib/modules/4.4.92-BPI-R64-Kernel/extra/mt_wifi.ko
 
  
* Then you will see ra0 and rai0.
+
====PWM FAN Control====
  [[Image:R64_wifi_test_1.jpg]]
+
* 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
  
* ra0 is MT7622 2.4G wifi
+
===miniPCIe slot===
* rai0 is MT7615 5G wifi
+
currently, miniPCIe slot only support one USB 4G module, example: EC25
 +
when you insert one EC25 module, you may check it.
  
====2.4G WiFi====
+
[[Image:BPI-R3-miniPCIe-Slot-EC25.jpg]]
* Use "ifconfig ra0 up" to enable it.
 
* Config the ip, "ifconfig ra0 192.168.1.1".
 
  
* Config your dhcp server, "vim /etc/dhcp/dhcpd.conf", add these configurations.
+
===SFP===
  [[Image:R64_Lan_test_2.jpg]]
+
After high and low temperature test, the following modules are suppoted by BPI-R3:
  
* Start dhcp server, "dhcpd ra0".
+
[[Image:SFP.png]]
  
* then config iptables and set package forward.
+
===4G&5G===
** Add "net.ipv4.ip_forward=1" to "/etc/sysctl.conf"
+
* BPI-R3 supports 4G LTE EC25.
** "/sbin/sysctl -p" to make forward work
+
* If you want to use 5G on BPI-R3:
** "iptables -t nat -A POSTROUTING -s 192.168.1.1/24 -o eth3 -j MASQUERADE"
+
    1. Insert 5G dongle into USB3.0.
 +
    2. Connect RG200U-CN to mini PCIe, connect SoC through USB2.0(speed limited).
 +
    3. Make an RG200U-CN LGA adapter board and insert it into M.2 KEY M.
 +
Note: The availability of 4G/5G depends on the local carrier frequency band.
  
====5G WiFi====
+
===Ap mode on BPI-R3===
* Use "ifconfig rai0 up" to enable it.
 
* Config the ip, "ifconfig rai0 192.168.1.1".
 
  
* Config your dhcp server, "vim /etc/dhcp/dhcpd.conf", add these configurations.
+
* ra0  is MT7986a 2.4G wifi
  [[Image:R64_Lan_test_2.jpg]]
+
* rax0 is MT7986a 5G wifi
  
* Start dhcp server, "dhcpd rai0".
+
===Wifi & Serial cable===
 +
* '''If the chip type of serial cable is pl2303, the driver fails to load the firmware apparently and thus the wifi can't work.'''
 +
* '''Other types including cp2102,ch340 and FDTI are all available, serial cable vlotage must be 3.3v LVTTL standard.
 +
'''
 +
'''UART_TX0 is the Boot Strapping PIN and must be kept low during power-on.'''
  
* then config iptables and set package forward.
+
[[File:Strapping.png|720px]]
** Add "net.ipv4.ip_forward=1" to "/etc/sysctl.conf"
 
** "/sbin/sysctl -p" to make forward work
 
** "iptables -t nat -A POSTROUTING -s 192.168.1.1/24 -o eth3 -j MASQUERADE"
 
  
 
==FAQ==
 
==FAQ==
*MT7622 Reference Manual for Develope Board(BPi)
+
*MT7986a Reference Manual for Develope Board(BPi)
::Google Drive:https://drive.google.com/open?id=1UhaIM9ork1O9cNO-t6ENMVVamB75AThV
+
::Google Drive:https://drive.google.com/file/d/1biSJmxnIpNzQroYDg9mtPtSTAv4i0DFf/view?usp=sharing
::BaiDu  Drive:https://pan.baidu.com/s/1KduFT2MUvMs2FhOF4A8kQQ
+
===TTL Voltage===
 +
:: The debug-uart TTL is tolerant to 3.3V.
  
 
='''Reference Link'''=
 
='''Reference Link'''=
  
 
http://forum.banana-pi.org/
 
http://forum.banana-pi.org/

Latest revision as of 18:02, 5 May 2024

Introduction

Banana Pi BPI-R3 Mini Router board with MediaTek MT7986(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 wifi use MT7975N and 5G wifi use MT7975P, support 2 2.5GbE network 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 MT7986(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 network 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 8G/above TF card, USB-Serial interface, Ubuntu System
 * Using your USB-Serial Connect debug console on BPI-R3
 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: MTK_MT7986_AP_AX6000_2.4GandMTK_MT7986_AP_AX6000_5G
 R3 debug console.jpg
 * R3 bootstrap and device select Jumper Setting
 BPI-R3-Jumper.png
  Note: SW1-A and SW1-B is for boot strap selecting;
        SW1-C is that SPI-Nand or SPI-Nor Device is connected to CPU's SPI bus;
        SW1-D is that SD Card or EMMC device is connected tp CPU's EMMC bus.

  * Examples:
    All Jumper is High.
    BPI-R3-Jumper-ALL-High.png
    All Jumper is Low.
    BPI-R3-Jumper-ALL-Low.png

How to burn image to SD card

 A. Note: burn image to SD card on linux computer
   1.You could download latest image from our forum
   * Here is the example image link: 
 
   2.Install bpi-tools on your Ubuntu. If you can't access this URL or any other problems, please go to bpi-tools repo and install this tools manually.
   * apt-get install pv
   * curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash
 
   3.After you download the image, insert your TF card into your Ubuntu
   * Execute "bpi-copy xxx.img /dev/sdx" to install image on your TF card
 
   4.After step 3, then you can insert your TF card into R3, and press power button to setup R3
 B. Note: burn image to SD card on windows computer
   1. Download the tools from the website:   https://sourceforge.net/projects/win32diskimager/
   2. Install the tools into Windows computer.
   3. flash image into SD card.
 
C. Change Boot Jumper to boot from SD, Enable SD Card Device.
   BPI-R3-Jumper-ALL-High.png

How to burn image to onboard eMMC

 Note: because SD card and EMMC device share one SOC's interface, you need flash one SD image firstly, then R3 boot from SD card, then flash nand image into Nand, then change boot strap to boot from nand,  you need flash EMMC image into EMMC. Finally you change bootstrap to boot from EMMC.
 Before burning image to eMMC, please prepare a SD card with flashed bootable image and a USB disk. Let's take OpenWrt image (mtk-bpi-r3-SD-WAN1-SFP1-20220619-single-image.img, mtk-bpi-r3-NAND-WAN1-SFP1-20220619-single-image.bin, bl2_emmc.img, mtk-bpi-r3-EMMC-WAN1-SFP1-20220619-single-image.img) for example, the steps are below:
 1. Insert the flashed SD card and power on to start the board.(the image "mtk-bpi-r3-SD-WAN1-SFP1-20220619-single-image.img" on the SD card can be OpenWrt or other linux OS like ubuntu...)
 2. Copy Nand bootable and EMMC boot OpenWrt image(mtk-bpi-r3-NAND-WAN1-SFP1-20220619-single-image.bin, bl2_emmc.img, mtk-bpi-r3-EMMC-WAN1-SFP1-20220619-single-image.img) to USB disk, if the image is compressed please uncompress it before copying to USB disk.
 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 nand flash:
    * mtd erase /dev/mtd0
    * dd if=mtk-bpi-r3-NAND-WAN1-SFP1-20220619-single-image.bin of=/dev/mtdblock0
 5. Shutdown, remove SD card, and change bootstrap to boot from nand flash and change SD/EMMC switch jumper to EMMC, restart the board from Nand Flash.
    Note: Enable EMMC device, boot strap is from nand
    BPI-R3-Jumper-Flash-EMMC.png
 6. repeat step 3, mount u-disk to /mnt, Execute following command to enable and copy image to EMMC device:
    * mount -t vfat /dev/sda1 /mnt
    * echo 0 > /sys/block/mmcblk0boot0/force_ro
    * dd if=bl2_emmc.img of=/dev/mmcblk0boot0
    * dd if=mtk-bpi-r3-EMMC-WAN1-SFP1-20220619-single-image.img of=/dev/mmcblk0
    * mmc bootpart enable 1 1 /dev/mmcblk0
 7. power off R3 board, remove u-disk driver, change bootstrap to boot from emmc device.
    Note: Enable EMMC device, boot strap is from EMMC.
    BPI-R3-Jumper-Boot-EMMC.png

Network-Configuration

BPI-R3 network 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

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

         UP BROADCAST 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)

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

         UP BROADCAST 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)

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

         UP BROADCAST 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)

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

         UP BROADCAST 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)

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

         UP BROADCAST 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)

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

         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)

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 lan0, eth1

root@OpenWrt:/# brctl show br-lan

bridge name bridge id STP enabled interfaces br-lan 7fff.eea15781ca19 no lan4, rax0, lan2, lan5, ra0, lan3, lan1

root@OpenWrt:/#

Advanced Development

GPIO

26 Pins Definition

R3 gpio 40.jpg

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

FAN.png

  • R317 for 5V FAN and R318 for 12V FAN.
  • CN23 supports PWM control while CN22 does not support.

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

miniPCIe slot

currently, miniPCIe slot only support one USB 4G module, example: EC25 when you insert one EC25 module, you may check it.

BPI-R3-miniPCIe-Slot-EC25.jpg

SFP

After high and low temperature test, the following modules are suppoted by BPI-R3:

SFP.png

4G&5G

  • BPI-R3 supports 4G LTE EC25.
  • If you want to use 5G on BPI-R3:
   1. Insert 5G dongle into USB3.0.
   2. Connect RG200U-CN to mini PCIe, connect SoC through USB2.0(speed limited).
   3. Make an RG200U-CN LGA adapter board and insert it into M.2 KEY M.

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

Ap mode on BPI-R3

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

Wifi & Serial cable

  • If the chip type of serial cable is pl2303, the driver fails to load the firmware apparently and thus the wifi can't work.
  • Other types including cp2102,ch340 and FDTI are all available, serial cable vlotage must be 3.3v LVTTL standard.

UART_TX0 is the Boot Strapping PIN and must be kept low during power-on.

Strapping.png

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 TTL is tolerant to 3.3V.

Reference Link

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