Getting Started with BPI-R4

From Banana Pi Wiki
Revision as of 01:30, 22 December 2023 by Sinovoip (talk | contribs) (How to burn image to onboard Nand)
Jump to: navigation, search

Development

Basic Development

Prepare to develop

 * Prepare 8G/above TF card, USB-Serial cable, Ubuntu System
 * Using your USB-Serial cable(3.3V TTL,Baud=115200) Connect to debug console on BPI-R4
   G=GND;  RX=BPI-R4 input;  TX=BPI-R4 output
    R4 DebugPort.png
 * BPI-R4 bootstrap and device select Jumper Setting
    R4-bootstrip.png


  * Examples:
 1. All Jumper is "1", BPI-R4 will boot from SD card
    R4 SDBOOT.png


 2. SW3-A is "0" and SW3-B is "1" , BPI-R4 will boot from SPI NAND
    R4 NANDBOOT.png


 3. SW3-A is "1" and SW3-B is "0" , BPI-R4 will boot from eMMC
    R4 eMMCBOOT.png


 4. If the console said "system halt!", it means that the bootup storage does not cotain any OS
    R4 systenHalt.png

How to burn image for SD, EMMC Nand

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 R4, and press power button to setup R4
 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-R4 SDBOOT.jpg
 
 * Note: please low level format the SD and clear all data of SD. it's very important.

How to burn image to onboard Nand
 Note: when you want to Update Nand device, Firstly Change boot switch to boot from SD device and insert one SD with SD boot Image, 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.
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-R4 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

eth2 Link encap:Ethernet HWaddr 22:02:CE:9C:92:BA

         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)

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:88

         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)

ra1 Link encap:Ethernet HWaddr 02:0C:43:36:60:88

         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)

rai0 Link encap:Ethernet HWaddr 00:0C:43:2B:B1:F8

         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)

rax0 Link encap:Ethernet HWaddr 0C:0C:43:26:60:D8

         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, eth2

root@OpenWrt:/# brctl show br-lan

bridge name bridge id STP enabled interfaces br-lan 7fff.eea15781ca19 no apclii0 apclix0 apcli0 ra1 rai0 rax0 lan2 eth1 ra0 lan3 lan1

root@OpenWrt:/#

Accessories

1. 10G SFP Module

The SFP serdes speed of BPI-R4 is fixed at 10Gbps, so only SFP that support this can be used!

Usually the PIN6 of 10G SFP+ module is GND. After inserting the module, SFP_MOD_DEF0 will be pulled low, thereby turning on the SFP power supply.

Therefore, if this PIN of the module is not GND, 3.3V_SFP power will not be supplied!

R4 SFP Power.png

10G SFP+ Copper Module

The temperature of this module is very high when used for a long time, It can reach 90℃ without a heat sink or cooling fan. Be careful to prevent burns!


SFP-10G-T-AQR.png

BPI-R4 SFP-10G-T(AQR113C).png


Note:

Do not pull out this module once it is inserted, otherwise it will cause BPI-R4 to reboot.This phenomenon does not exist with other modules.


BPI-R4 SFP-10G-T(AQR113C)-Pull out reboot.png

10G SFP+ Fibre Module

SFP-10G-BX20.png

BPI-R4 SFP-10G-BX20.png

2. 4G/5G Module

  • BPI-R4 supports 4G LTE EC25. Quectel RM500U-CN & RM520N-GL 5G Modules.
  • If you want to use 5G on BPI-R4:
   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.

3. SSD

  • please insert one M2.KeyM SSD into M2.KeyM slot.

BPI-R4-M2 KeyM-SSD Connnect.jpg

BPI-R4-M2 KeyM-SSD Linux.jpg

4. Asia mPCIe WiFi6/WiFi6E