Difference between revisions of "Getting Started with M64"

From Banana Pi Wiki
Jump to: navigation, search
(BPI-M2M)
(Prepare)
 
(45 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
[[zh:快速上手 香蕉派 BPI-M64]]
 
=Introduction=
 
=Introduction=
==BPI-M64==
+
[[File:Banana_pi_BPI-M64_1.jpg|thumb|Overview [[Banana Pi BPI-M64]]]]
 
[[File:M64_respbian.png|thumb|Overview: BPI-M64 respbian linux]]
 
[[File:M64_respbian.png|thumb|Overview: BPI-M64 respbian linux]]
  
  Banana Pi BPI-M64 is a 64-bit quad-core mini single board computer. It features 2GB of RAM and 8GB eMMC. It also has onboard WiFi and BT. On the ports side, the BPI-M64 has 2 USB A 2.0 ports, 1 USB OTG port, 1 HDMI port, 1 audio jack, and lastly a DC power port. The processor is pin-to-pin comptialbe with R18, so it comes with two versions:M64 and M64-R18
+
Banana Pi BPI-M64 is a 64-bit quad-core mini single board computer. It features 2GB of RAM and 8GB eMMC. It also has onboard WiFi and BT. On the ports side, the BPI-M64 has 2 USB A 2.0 ports, 1 USB OTG port, 1 HDMI port, 1 audio jack, and lastly a DC power port. The processor is pin-to-pin comptialbe with R18, so it comes with two versions:M64 and M64-R18
  
 
*Read more about : [[Banana Pi BPI-M64]]
 
*Read more about : [[Banana Pi BPI-M64]]
Line 21: Line 22:
 
* WiFi (AP6212) & Bluetooth
 
* WiFi (AP6212) & Bluetooth
  
=Development=
+
=Development For Android=
==Basic Development==
+
==Install Android Image==
===Prepare to develop===
+
===Prepare===
  * Prepare 8G/above TF card, USB-Serial interface, PC with Ubuntu System
+
:1. Prepare a USB-Serial cable, a MicroUSB cable and PC with Linux or WIndows 7/10
  * Using your USB-Serial Connect debug console on M64
+
:2. The USB-Serial cable is used for console debug and MicroUSB cable is used for Image download and ADB debug.
 +
:3. M64 board is only suport DC power supply bootup.
 +
:4. If you want insert a SDcard for Android storage using, and your SDcard was download Linux Image or any other allwinner bootable SDcard image, please format the SDcard start from block 0.
 +
:5. Download and Install [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/?p=%2FTools%2Fimage_download_tools&mode=list Allwinner Image Download Tools], PhoenixSuit is for window and LiveSuit is for Linux
 +
:6. Download BPI [http://wiki.banana-pi.org/Banana_Pi_BPI-M64#Android latest Android Image]
  
===Load your first image on M64===
+
===Install Image with PhoenixSuit on Windows===
  1.You could download latest image from our forum
+
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.
 
+
 
  2.Install bpi-tools on your system
+
:[[File:firmware_panel.png]]
  * apt-get install pv
+
 
  * curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash
+
:2. M64 board disconnect DC power, press and hold the uboot-key button(new uart debug pin), plugin mirco-usb cable to PC, popup a warning dialog.
 
+
 
  3.After you download the image, insert your TF card into your Ubuntu
+
:[[File:usb_plugin_warning.png]]
  * Execute "bpi-copy xxx.img /dev/sdx" to install image on your TF card.
+
 
 
+
:3 Press Yes to continue and popup another waring dialog, Press Yes to continue
  4.After step 3, then you can insert your TF card into M64, and press power button setup M64
+
:4 Downloading
 +
 
 +
:[[File:downloading.png]]
 +
 
 +
:5 Download finish
 +
:[[File:download_finish.png]]
 +
 
 +
===Install Image with LiveSuit on Linux===
 +
:According to the Readme.pdf in LiveSuit Install package, After install the LiveSuit successfully please run LiveSuit.sh with '''root permission''', then the  download process is almost the same as PhoenixSuit.
 +
 
 +
:[[File:live_suit.png]]
 +
 
 +
==Build Android source code==
  
===Load your first image on M64 EMMC===
+
Get Android source code
  * Run your M64 with TF card
+
:Android 7.1
   * Copy "xxx-sd-emmc-xxx.img.zip / xxx-sd-emmc-xxx.img" to your USB disk
+
   $ git clone https://github.com/BPI-SINOVOIP/BPI-A64-Android7
  * Plug your USB disk in M2U
 
  * After M64 recognise USB disk, execute "bpi-copy xxx-sd-emmc-xxx.img.zip / xxx-sd-emmc-xxx.img" to install image on EMMC
 
  * Then power off M64, take TF card out, power on M64
 
  
==Advanced Development==
+
:Android 6.1
===How to build uboot & kernel===
+
  $ git clone https://github.com/BPI-SINOVOIP/BPI-A64-Android
====Install tools====
 
* apt-get udpate
 
* apt-get install gcc-arm-linux-gnueabihf u-boot-tools
 
* apt-get install pv
 
* curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash
 
  
===SATA===
+
Build Android Source code
1. Mount SATA on M2U
+
:Please read the source code README.md
  
  [[Image:A64_Sata.png]]
+
=Development For Linux=
 +
==Install Linux Image==
 +
===Prepare===
 +
:1. Prepare 8G/above TF card, USB-Serial interface, PC with Ubuntu System
 +
:2. Using your USB-Serial Connect debug console on M64
 +
:3. M64 board is only suport DC power supply bootup
 +
:4. Install bpi-tools on your Linux PC. 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
 +
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash
 +
:5. Download BPI [http://wiki.banana-pi.org/Banana_Pi_BPI-M64#Image_Release latest image]
 +
:6. Login user/password: pi/bananapi or root/bananapi
  
* After insert sata interface, execute "fdisk -l"
+
===Install Image to SDcard===
   [[Image:A64_Sata_fdisk_l.png]]
+
:1. Install image with bpi-tools on Linux
 +
::plug your sd card to your Linux PC, and run
 +
  $ sudo bpi-copy  xxx.img /dev/sdX
 +
    
 +
:2. Install bpi image with Etcher on Windows, Linux and MacOS
 +
::[https://www.balena.io/etcher/ Balena Etcher] is an open source project by Balena, Flash OS images to SD cards & USB drives
  
* Then "mount /dev/sdx /mnt/xxx"
+
===Install Image to EMMC===
 +
:1. Prepare a sd which is installed Linux image and bootup with sdcard
 +
:2. Copy emmc image to udisk then plug in M64, then mount udisk.
 +
:3. After mount udisk, use command "bpi-copy xxx-emmc-xxx.img" to install image on Emmc.
 +
:4. After success install, power off M64, eject the sdcard and poweron with emmc boot.
  
2. If you meet some errors when you mount SATA, try these following commands:
+
===Switch to LCD boot type===
 +
:1. The default release images are HDMI boot type, you can switch to LCD boot type for BPI 7" LCD support after first boot.
 +
  $ sudo bpi-bootsel /usr/lib/u-boot/bananapi/bpi-m64/BPI-M64-LCD7-linux4.4-8k.img.gz
 +
  $ reboot
  
* "fdisk /dev/sdx" to create new partition , set your partition numbers and size, after created partitions, input "wq" to save and quit.
+
:2. Load the Touchscreen driver if you want to using TP
* "mkfs.ext2 /dev/sdx" to format the SATA
+
  $ sudo modprobe gt9xxnew_ts.ko
* "mount /dev/sdx /mnt/xxx"
 
  
3. After you success to insert SATA, we could input following commands to test SATA interface:
+
==Build Linux source code==
* "time dd if=/dev/xxx of=/dev/null bs=1M count=1000" to test read speed
 
* "time dd if=/dev/zero of=/dev/sdx bs=1M count=1000" to test write speed
 
  [[Image:Sata_test.png]]
 
  
 +
Get the bsp source code
  
===LCD 5" & LCD 7"===
+
  $ git clone https://github.com/BPI-SINOVOIP/BPI-M64-bsp-4.4
* Execute "bpi-bootsel", you'll see a list of boot files
 
* Find "BPI_A64_LCD7.img.gz"
 
* Then execute "bpi-bootsel /usr/lib/u-boot/bananapi/bpi-m64/u-boot-with-dtb-bpi-m64-lcd7-8k.img.gz"
 
  [[Image:A64_bootsel_lcd7.png]]
 
  
===Touch screen===
+
Build the bsp source code
 +
:Please read the source code README.md
  
 +
==Other development and test==
 
===GMAC===
 
===GMAC===
 
Use iperf3 to test gmac
 
Use iperf3 to test gmac
Line 111: Line 137:
 
* iw dev wlan0 scan | grep SSID
 
* iw dev wlan0 scan | grep SSID
 
* vim /etc/wpasupplicant/wpa_supplicant.conf  
 
* vim /etc/wpasupplicant/wpa_supplicant.conf  
* network={    ssid="ssid"    psk="password"    priority=1 }
+
  network={     
* wpa_supplicant -B -dd -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
+
  ssid="ssid"     
 +
  psk="password"     
 +
  priority=1  
 +
  }
 +
* wpa_supplicant -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
 
* dhclient wlan0
 
* dhclient wlan0
  
 
2. Use UI interface to setup WiFi Client
 
2. Use UI interface to setup WiFi Client
 +
 +
====Ap Mode====
 +
1.Install hostapd and create hostapd configuration file hostapd.conf:
 +
interface=wlan0
 +
driver=nl80211
 +
ssid=test
 +
hw_mode=g
 +
channel=1
 +
 +
2.Execute command:"hostapd -d /<path>/hostapd.conf"
 +
If you meet problem like this:
 +
 +
[[Image:A64_ap_1.png]]
 +
 +
Then, you could solve by following command:
 +
* nmcli radio wifi off
 +
[[Image:A64_ap_2.png]]
 +
* rfkill unblock 1
 +
* rfkill unblock 2
 +
* ifconfig wlan0 up
 +
* hostapd -d  hostapd.conf
 +
[[Image:A64_ap_3.png]]
  
 
===Clear boot===
 
===Clear boot===
 
* git clone https://github.com/BPI-SINOVOIP/BPI-files/tree/master/SD/100MB
 
* git clone https://github.com/BPI-SINOVOIP/BPI-files/tree/master/SD/100MB
 
* bpi-bootsel BPI-cleanboot-8k.img.gz /dev/sdX
 
* bpi-bootsel BPI-cleanboot-8k.img.gz /dev/sdX
 +
 +
===GPIO Control===
 +
* To access a GPIO pin you first need to export it with
 +
  echo XX > /sys/class/gpio/export
 +
* with XX being the number of the desired pin. To obtain the correct number you have to calculate it from the pin name (like PH18)
 +
  (position of letter in alphabet - 1) * 32 + pin number
 +
  for PH18 this would be ( 8 - 1) * 32 + 18 = 224 + 18 = 242 (since 'h' is the 8th letter)
 +
* echo "out/in" > /sys/class/gpio/gpio*NUMBER*/direction
 +
* echo "0/1" > /sys/class/gpio/gpio*NUMBER*/value
  
 
===Camara function===
 
===Camara function===
Line 136: Line 197:
 
* Execute "getevent"
 
* Execute "getevent"
 
* Use your IR device to send information to A64
 
* Use your IR device to send information to A64
 +
 +
===RPi.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 "./bpi_test_g40.py" to test RPi.GPIO
 +
 +
[[Image: RPi_GPIO.png]]
 +
  
 
===WringPi===
 
===WringPi===
 
* GitHub: https://github.com/BPI-SINOVOIP/BPI-WiringPi2.git
 
* GitHub: https://github.com/BPI-SINOVOIP/BPI-WiringPi2.git
 
* We also have built-in test command in "/usr/local/bin"
 
* We also have built-in test command in "/usr/local/bin"
 +
 +
====How to Update WiringPi====
 +
* Execute "bpi-update -c pkglist.conf"
 +
[[Image: Update_Pkglist.png]]
 +
 +
* If your image is 32bit please do this command to install wring pi
 +
* Execute "bpi-update -c bpi-pkg-bpi-wiringpi.conf"
 +
* If your image is 64bit please do:"bpi-update -c bpi-pkg-bpi-wiringpi-arm64.conf"
 +
 +
[[Image: Update_WringPi.png]]
  
 
====RGB 1602 LCD====
 
====RGB 1602 LCD====

Latest revision as of 01:14, 2 September 2020

Introduction

Overview: BPI-M64 respbian linux

Banana Pi BPI-M64 is a 64-bit quad-core mini single board computer. It features 2GB of RAM and 8GB eMMC. It also has onboard WiFi and BT. On the ports side, the BPI-M64 has 2 USB A 2.0 ports, 1 USB OTG port, 1 HDMI port, 1 audio jack, and lastly a DC power port. The processor is pin-to-pin comptialbe with R18, so it comes with two versions:M64 and M64-R18

A64 Key Features

  • 1.2 Ghz Quad-Core ARM Cortex A53 64-Bit Processor-A64
  • 2GB DDR3 SDRAM
  • 8G EMMC
  • 10/100/1000Mbps Ethernet
  • WiFi (AP6212) & Bluetooth

R18 Key Features

  • 1.2 Ghz Quad-Core ARM Cortex A53 64-Bit Processor-R18
  • 2GB DDR3 SDRAM
  • 8G EMMC
  • 10/100/1000Mbps Ethernet
  • WiFi (AP6212) & Bluetooth

Development For Android

Install Android Image

Prepare

1. Prepare a USB-Serial cable, a MicroUSB cable and PC with Linux or WIndows 7/10
2. The USB-Serial cable is used for console debug and MicroUSB cable is used for Image download and ADB debug.
3. M64 board is only suport DC power supply bootup.
4. If you want insert a SDcard for Android storage using, and your SDcard was download Linux Image or any other allwinner bootable SDcard image, please format the SDcard start from block 0.
5. Download and Install Allwinner Image Download Tools, PhoenixSuit is for window and LiveSuit is for Linux
6. Download BPI latest Android Image

Install Image with PhoenixSuit on Windows

1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.
Firmware panel.png
2. M64 board disconnect DC power, press and hold the uboot-key button(new uart debug pin), plugin mirco-usb cable to PC, popup a warning dialog.
Usb plugin warning.png
3 Press Yes to continue and popup another waring dialog, Press Yes to continue
4 Downloading
Downloading.png
5 Download finish
Download finish.png

Install Image with LiveSuit on Linux

According to the Readme.pdf in LiveSuit Install package, After install the LiveSuit successfully please run LiveSuit.sh with root permission, then the download process is almost the same as PhoenixSuit.
Live suit.png

Build Android source code

Get Android source code

Android 7.1
 $ git clone https://github.com/BPI-SINOVOIP/BPI-A64-Android7
Android 6.1
 $ git clone https://github.com/BPI-SINOVOIP/BPI-A64-Android

Build Android Source code

Please read the source code README.md

Development For Linux

Install Linux Image

Prepare

1. Prepare 8G/above TF card, USB-Serial interface, PC with Ubuntu System
2. Using your USB-Serial Connect debug console on M64
3. M64 board is only suport DC power supply bootup
4. Install bpi-tools on your Linux PC. 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
5. Download BPI latest image
6. Login user/password: pi/bananapi or root/bananapi

Install Image to SDcard

1. Install image with bpi-tools on Linux
plug your sd card to your Linux PC, and run
  $ sudo bpi-copy  xxx.img /dev/sdX
 
2. Install bpi image with Etcher on Windows, Linux and MacOS
Balena Etcher is an open source project by Balena, Flash OS images to SD cards & USB drives

Install Image to EMMC

1. Prepare a sd which is installed Linux image and bootup with sdcard
2. Copy emmc image to udisk then plug in M64, then mount udisk.
3. After mount udisk, use command "bpi-copy xxx-emmc-xxx.img" to install image on Emmc.
4. After success install, power off M64, eject the sdcard and poweron with emmc boot.

Switch to LCD boot type

1. The default release images are HDMI boot type, you can switch to LCD boot type for BPI 7" LCD support after first boot.
 $ sudo bpi-bootsel /usr/lib/u-boot/bananapi/bpi-m64/BPI-M64-LCD7-linux4.4-8k.img.gz
 $ reboot
2. Load the Touchscreen driver if you want to using TP
 $ sudo modprobe gt9xxnew_ts.ko

Build Linux source code

Get the bsp source code

 $ git clone https://github.com/BPI-SINOVOIP/BPI-M64-bsp-4.4

Build the bsp source code

Please read the source code README.md

Other development and test

GMAC

Use iperf3 to test gmac

1. On PC Terminal:

  • Execute "iperf3 -s"

2. On M2U console:

  • TCP test: "iperf3 -c serverIP"
  • UDP test: "iperf3 -u -c serverIP"

A64 Gmac test.png

Bluetooth

  • Use bluetoothctl tool to operate BT
  • Execute "bluetoothctl"
  • If you don't know how to use bluetoothctl, type "help", you will see more commands
  • Execute these commands:

A64 bluetooth.png

WiFi on A64

WiFi Client

You have two ways to setup WiFi Client

1. Use commands to setup WiFi client

  • ip link set wlan0 up
  • iw dev wlan0 scan | grep SSID
  • vim /etc/wpasupplicant/wpa_supplicant.conf
 network={    
 ssid="ssid"    
 psk="password"    
 priority=1 
 }
  • wpa_supplicant -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
  • dhclient wlan0

2. Use UI interface to setup WiFi Client

Ap Mode

1.Install hostapd and create hostapd configuration file hostapd.conf:

interface=wlan0
driver=nl80211
ssid=test
hw_mode=g
channel=1

2.Execute command:"hostapd -d /<path>/hostapd.conf" If you meet problem like this:

A64 ap 1.png

Then, you could solve by following command:

  • nmcli radio wifi off

A64 ap 2.png

  • rfkill unblock 1
  • rfkill unblock 2
  • ifconfig wlan0 up
  • hostapd -d hostapd.conf

A64 ap 3.png

Clear boot

GPIO Control

  • To access a GPIO pin you first need to export it with
 echo XX > /sys/class/gpio/export
  • with XX being the number of the desired pin. To obtain the correct number you have to calculate it from the pin name (like PH18)
 (position of letter in alphabet - 1) * 32 + pin number
  for PH18 this would be ( 8 - 1) * 32 + 18 = 224 + 18 = 242 (since 'h' is the 8th letter)
  • echo "out/in" > /sys/class/gpio/gpio*NUMBER*/direction
  • echo "0/1" > /sys/class/gpio/gpio*NUMBER*/value

Camara function

We use HDF5640 camara.

Ov5640 camara.png

Guvcview

  • Use your UI interface to operate camara
  • Applications -> Sound & Video -> guvcview

Shell

  • We also have built-in command in "/usr/local/bin" to test camara
  • "./test_ov5640_image_mode.sh" to test picture taking function
  • "./cameratest.sh" to test video recording function

IR function

  • Execute "getevent"
  • Use your IR device to send information to A64

RPi.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 "./bpi_test_g40.py" to test RPi.GPIO

RPi GPIO.png


WringPi

How to Update WiringPi

  • Execute "bpi-update -c pkglist.conf"

Update Pkglist.png

  • If your image is 32bit please do this command to install wring pi
  • Execute "bpi-update -c bpi-pkg-bpi-wiringpi.conf"
  • If your image is 64bit please do:"bpi-update -c bpi-pkg-bpi-wiringpi-arm64.conf"

Update WringPi.png

RGB 1602 LCD

  • Execute "/usr/local/bin/bpi_test_lcd1602.sh"

0.96 Inch OLED Display

  • Execute "/usr/local/bin/bpi_test_52pi.sh"

8x8 RGB LED Martix

  • Firstly you need a GPIO Extend Board for 8x8 LED Martix

WringPi LED Martix Extend Board.png

  • Execute "/usr/local/bin/bpi_test_gpio40.sh"

File System

  • read only system change to read & write mode: "mount -o remount,rw /"

FAQ