Getting Started with BPI-R4
Contents
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
* BPI-R4 bootstrap and device select Jumper Setting
* Examples:
1. All Jumper is "1", BPI-R4 will boot from SD card
2. SW3-A is "0" and SW3-B is "1" , BPI-R4 will boot from SPI NAND
3. SW3-A is "1" and SW3-B is "0" , BPI-R4 will boot from eMMC
4. If the console said "system halt!", it means that the bootup storage does not cotain any OS
How to burn image for SD, EMMC Nand
Release Image: https://wiki.banana-pi.org/Banana_Pi_BPI-R4#Release_image Note: boot device select: https://wiki.banana-pi.org/Getting_Started_with_BPI-R4#Prepare_to_develop
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 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 Balena Etcher is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive. Click on "Flash from file" to select image. Click on "Select target" to select USB device. Click on "Flash!" Start burning. C. Change Boot Jumper to boot from SD, Enable SD Card Device. * Note: boot device select: https://wiki.banana-pi.org/Getting_Started_with_BPI-R4#Prepare_to_develop * 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-r4-NAND-20231030.img) for example, the steps are below: 1. Copy Nand boot OpenWrt image(mtk-bpi-r4-NAND-20231030.img) to USB disk. 2. Change boot switch Jumper, the board boot from SD 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-r4-NAND-20231030.img of=/dev/mtdblock0 5. Power off BPI-R4 board, unplug u-disk driver, change bootstrap to boot from Nand device. * Note: Enable Nand device, boot strap is from Nand. * Note: boot device select: https://wiki.banana-pi.org/Getting_Started_with_BPI-R4#Prepare_to_develop
How to burn image to onboard eMMC
Note: because SD card and EMMC device share one SOC's controller, it is necessary to switch to NAND startup and then burn the EMMC image into the EMMC. Finally, you will change the boot to boot from EMMC. Before burning image to eMMC, please prepare a USB disk. Let's take OpenWrt image (bl2_emmc-r4.img, mtk-bpi-r4-EMMC-20231030.img) for example, the steps are below: 1. Copy EMMC boot OpenWrt image(bl2_emmc-r4.img, mtk-bpi-r4-EMMC-20231030.img) to USB disk, if the image is compressed please uncompress it before copying to USB disk. 2. Change the switch jumper to Nand and start the motherboard from Nand. Note: Enable Nand device, boot strap is from Nand 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 : * echo 0 > /sys/block/mmcblk0boot0/force_ro * dd if=bl2_emmc-r4.img of=/dev/mmcblk0boot0 * dd if=mtk-bpi-r4-EMMC-20231030.img of=/dev/mmcblk0 * mmc bootpart enable 1 1 /dev/mmcblk0 5. Power off R4 board, remove u-disk driver, change bootstrap to boot from emmc device. * Note: Enable EMMC device, boot strap is from EMMC. * Note: boot device select: https://wiki.banana-pi.org/Getting_Started_with_BPI-R4#Prepare_to_develop
Network-Configuration
- Network-Configuration refer to: http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:network:start
- Network Interface: eth2, lan0 is for WAN; eth1, lan0, lan1, lan2, lan3 is for LAN, ra0 is for 2.4G wireless, rai0 is for 5G wifi6 wireless, rax0 is for 6G wifi7 wireless.
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!
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!
root@R4CN:/# [ 67.870063] sfp sfp@0: SM: enter empty:up:down event insert [ 67.875642] sfp sfp@0: SM: exit probe:up:down [ 68.199179] sfp sfp@0: SM: enter probe:up:down event timeout [ 68.215970] sfp sfp@0: module OEM SFP-10G-T rev 10 sn 2309250003 dc 230925 [ 68.225443] sfp sfp@0: module OEM SFP-10G-T rev 10 has been found in the quirk list [ 68.235004] sfp sfp@0: sfp: support mode 00,00000800,00007040 [ 68.240749] sfp sfp@0: tx disable 1 -> 0 [ 68.244681] sfp sfp@0: SM: exit present:up:wait [ 68.343638] sfp sfp@0: SM: enter present:up:wait event los_high [ 68.349549] sfp sfp@0: SM: exit present:up:wait [ 82.476711] sfp sfp@0: SM: enter present:up:wait event los_low [ 82.482550] sfp sfp@0: SM: exit present:up:wait [ 83.584504] alloc new entry for 18:f2:2c:6f:45:3e, interface:eth2 [ 83.590595] recv intf mac ae:19:d1:7e:2a:74 [ 95.271188] sfp sfp@0: SM: enter present:up:wait event timeout [ 95.277715] sfp sfp@0: probing phy device through the [MDIO_I2C_ROLLBALL] protocol [ 95.821247] sfp sfp@0: CL45 PHY device [0x31c3:0x1c13] found! [ 95.826999] sfp sfp@0: CL45 PHY device [0x31c3:0x1c13] found! [ 95.832741] sfp sfp@0: CL45 PHY device [0x31c3:0x1c13] found! [ 95.838479] sfp sfp@0: CL45 PHY device [0x31c3:0x1c13] found! [ 95.844217] sfp sfp@0: CL45 PHY driver [Aquantia AQR113C] found! [ 95.850215] sfp sfp@0: phy: support mode 00,00018000,000e706c [ 95.855960] mtk_soc_eth 15100000.ethernet eth2: requesting link mode inband/10gbase-kr with support 00,00018000,000a7068 [ 96.273193] mtk_soc_eth 15100000.ethernet eth2: PHY [i2c:sfp@0:11] driver [Aquantia AQR113C] [ 96.357199] sfp sfp@0: SM: exit present:up:link_up [ 96.357206] mtk_soc_eth 15100000.ethernet eth2: resolve link status: system iface=1, line iface=0 [ 96.630718] sfp sfp@0: SM: enter present:up:link_up event los_high [ 96.636904] sfp sfp@0: SM: exit present:up:wait_los [ 101.395228] sfp sfp@0: SM: enter present:up:wait_los event los_low [ 101.401416] sfp sfp@0: SM: exit present:up:link_up [ 101.401426] mtk_soc_eth 15100000.ethernet eth2: resolve link status: system iface=1, line iface=0 [ 101.696172] mtk_soc_eth 15100000.ethernet eth2: Link is Up - 10Gbps/Full - flow control off [ 101.704534] br-wan: port 2(eth2) entered blocking state [ 101.709754] br-wan: port 2(eth2) entered forwarding state root@R4CN:/#
root@R4CN:/# i2cdetect -y 3 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: 50 51 -- -- -- -- 56 -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: UU -- -- -- -- -- -- -- root@R4CN:/#
root@R4CN:/# ethtool eth2 Settings for eth2: Supported ports: [ ] Supported link modes: 100baseT/Full 1000baseT/Full 10000baseT/Full 1000baseKX/Full 10000baseKR/Full 2500baseT/Full 5000baseT/Full Supported pause frame use: Symmetric Receive-only Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 100baseT/Full 1000baseT/Full 10000baseT/Full 1000baseKX/Full 10000baseKR/Full 2500baseT/Full 5000baseT/Full Advertised pause frame use: Symmetric Receive-only Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Link partner advertised link modes: 10baseT/Full 100baseT/Full 1000baseT/Full 10000baseT/Full 2500baseT/Full 5000baseT/Full Link partner advertised pause frame use: No Link partner advertised auto-negotiation: Yes Link partner advertised FEC modes: Not reported Speed: 10000Mb/s Duplex: Full Port: MII PHYAD: 17 Transceiver: external Auto-negotiation: on Current message level: 0x000000ff (255) drv probe link timer ifdown ifup rx_err tx_err Link detected: yes root@R4CN:/#
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.
10G SFP+ Fibre Module
2. 4G/5G Module
- BPI-R4 supports M.2 USB Interface Quectel 4G LTE EM25, RM500U-CN & RM520N-GL 5G Modules.
Theoretically, it also supports PCIe cellular modules, but it has not been tested
- If you want to use Cellular Module on BPI-R4:
1. Install 4G/5G Cellular Module into CN16 Slot(M.2 KEYB) 2. Inset NANOSIM Card into SIMSlot(SIM1) with card tray(pay attention to the direction) 3. Install antenna on the module 4. After powering on, it will automatically dial
Note: The availability of 4G/5G depends on the local carrier frequency band.
3. NVMe SSD
- please insert one M2.KeyM SSD into M2.KeyM slot.