Getting Started with R2 - Banana Pi Wiki
Introduction
Read more: Banana Pi BPI-R2
Key Features
MediaTek MT7623N, Quad-core ARM Cortex-A7
Mali 450 MP4 GPU
2G DDR3 SDRAM
1x Mini PCIE interface
2x SATA interface
4x Gigabit LAN 1x Gigabit WAN
Hardware
BPI-R2 SATA interface
BPI-R2 support 2 sata interface and onboard power port.
you can use sata line connect your hardisk on BPI-R2.
Test a SAMSUNG SSD DISK, the Read/Write performance are below:
Read from disk: 230MB/s \(command: dd if=/dev/sda of=/dev/zero bs=1M count=10240\) Write to disk: 192MB/s \(command: dd if=/dev/zero of=/dev/sda bs=1M count=1024 oflag=direct\)
Note:
if you use 3.5 big hardisk ,you may need power with outside power. on board power maybe can not support enough current
Development
Let's get start to develop on BPI-R2, see amazing things happen.
Basic Development
Prepare to develop
Load your first image on R2
Update Your Ubuntu On SD Card
Ubuntu On Emmc
OpenWrt On SD & Emmc Steps
1,Banana Pi R2 install openWRT: https://www.cnblogs.com/topbin/p/8794152.html
2,Banana Pi R2 Openwrt Network port configuration analysis : https://www.cnblogs.com/topbin/p/9518279.html
3,Banana Pi R2 developing a simple router based on Openwrt : https://www.cnblogs.com/topbin/p/9519881.html
4,Banana Pi R2 Openwrt Luci : https://www.cnblogs.com/topbin/p/9519875.html
Network-Configuration
Network-Configuration : http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:network:start
Advanced Development
GPIO
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 233
For example: if you want to change gpio 22 as out highlevel, you need input commands like this:
echo 255(22+233) > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio255/direction
echo 1 > /sys/class/gpio/gpio255/value
PWM Control
echo x >/sys/class/pwm/pwmchip0/export
echo 200000 >/sys/class/pwm/pwmchip0/pwmx/period
echo 100000 >/sys/class/pwm/pwmchip0/pwmx/duty_cycle
echo 1 >/sys/class/pwm/pwmchip0/pwmx/enable
More about GPIO : http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:gpio
Install RPi.GPIO
Execute "git clone https://github.com/BPI-SINOVOIP/RPi.GPIO"
after clone the repo, cd RPi.GPIO
Execute "sudo apt-get update"
Execute "sudo apt-get install python-dev python3-dev"
Execute "sudo python setup.py install" or "sudo python3 setup.py install" to install the module
Using RPi.GPIO
cd /usr/local/bin
Execute "./g40.py" to test RPi.GPIO
Develop 4G module with R2
Gets more info from here:
WiFi and Ap mode on R2 Ubuntu
STA
wmt_loader (ignore errors)
stp_uart_launcher -p /etc/firmware &
ip link set wlan0 up
iw dev wlan0 scan | grep SSID
vim /etc/wpasupplicant/wpa_supplicant.conf
wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
dhclient wlan0
AP mode
wmt_loader (ignore errors)
stp_uart_launcher -p /etc/firmware &
echo A >/dev/wmtWifi
create your hostapd.conf: "vim /etc/hostapd/hostapd.conf "
According to your network interface(can search internet) to config ap0:
“ifconfig ap0 192.168.30.188 netmask 255.255.255.0”
Run hostapd : “hostapd -d /etc/hostapd/hostapd.conf”
Config dhcp file : “vim /etc/dhcp/dhcpd.conf”
Config dhcp of ap0, then the devices which connect ap0 could get IP: "dhcpd ap0 -pf /var/run/dhcpd.pid "
And a bridge
brctl addbr br0
brctl addif br0 ap0
brctl addif br wan
Config br0 : “ifconfig br0 192.168.30.180 netmask 255.255.255.0”
Add br0 gw as : “route add -net default netmask 255.255.255.0 gw 192.168.30.1 dev br0”
Ap Mode FAQ
If you meet problem like this:
Then, you could solve by following command:
nmcli radio wifi off
rfkill unblock 1
rfkill unblock 2
ifconfig ap0 up
hostapd -d hostapd.conf
WiFi and Ap mode on R2 Openwrt
AP mode
1. Make a bash script
vim setup.sh
2. Create your hostapd.conf
vim hostapd.conf
3. Make it run
./setup.sh
4. Add it to starting progress
vim /etc/rc.local
5. If your Ap is not stable, please limit the speed, here I limit download speed as 8Mbit/s, upload as 4Mbit/s
tc qdisc add dev ap0 root handle 1: htb default 11
tc class add dev ap0 parent 1:1 classid 1:2 htb rate 8Mbit ceil 4Mbit prio 2
Make your own image
Prepare a SD card which have installed Ubuntu system
Boot your SD card with R2, after R2 finish starting, copy your files and config your Ubuntu, then poweroff R2
Plug your SD card in Linux PC, "cd /media", then "ln -s pi"
Execute "bpi-migrate -c bpi-r2.conf -c ubuntu-mate-from-sd.conf -d /dev/sdx"
Then you could get your own image now
FAQ
1.Banana Pi BPI-R2 Razberry board OpenHab2
https://community.openhab.org/t/banana-pi-bpi-r2-razberry-board-openhab2-help/37222/8
Reference Link
http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:start
Last updated