Getting Started with M2M

From Banana Pi Wiki
Revision as of 00:50, 24 March 2021 by Dangku (talk | contribs) (Install Image to EMMC)
Jump to: navigation, search



Overview: BPI-M2M ubuntu linux
  Banana Pi M2M is another ARM SoC powered development board that offers great computing performance in an ultra portable form factor. It is a 51mm square with Allwinner A33 Quad-core A7 SoC and 512MB DDR3 RAM. 

Key Features

  • Quad Core ARM Cortex A7 CPU. R16
  • 512MB DDR3 SDRAM
  • WiFi (AP6212) & Bluetooth onboard




1. Prepare 8G/above TF card, USB-Serial interface.
2. Connect USB-Serial to 40 pin header uart2 for kernel console debug, 3 pin header uart0 beside usb port is not debug uart for bpi release images.
 M2M debug console.png  M2M pin define.png
3. 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 download this tools manually.
 $ apt-get install pv
 $ curl -sL | sudo -E bash
4. Download latest linux image, and confirm that the md5 checksum is correct.
5. Defautl login: 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
   $ sudo bpi-copy /dev/sdX
2. Install image with dd command on Linux, umount SDcard device /dev/sdX partitions if mounted automatically, Actually bpi-copy is the same as this dd command.
   $ sudo apt-get install pv
   $ sudo unzip -p | pv | dd of=/dev/sdX bs=10M status=noxfer
3. 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 SDcard with Linux image flashed and bootup the board with this SDcard.
2. Copy emmc image to udisk, plugin the udisk to board and mount it.
3. Install with bpi-tools command
   $ sudo bpi-copy /dev/mmcblk1
4. Or Install with dd command, umount mmcblk1p1 and mmcblk1p2 partition if mounted automatically, Actually bpi-copy is the same as this dd command
   $ sudo apt-get install pv
   $ sudo unzip -p | pv | dd of=/dev/mmcblk1 bs=10M status=noxfer
5. After flash complete, power off safely and eject the sdcard.

Note: If the emmc was flashed android image before, you must erase the boot partition of android before step 3 or step 4.

   root@bpi-iot-ros-ai:/# echo 0 > /sys/block/mmcblk1/mmcblk1boot0/force_ro                              
   root@bpi-iot-ros-ai:/# echo 0 > /sys/block/mmcblk1/mmcblk1boot1/force_ro                              
   root@bpi-iot-ros-ai:/# dd if=/dev/zero of=/dev/mmcblk1boot0 bs=4096 count=1024                        
   1024+0 records in
   1024+0 records out
   4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.421164 s, 10.0 MB/s
   root@bpi-iot-ros-ai:/# dd if=/dev/zero of=/dev/mmcblk1boot1 bs=4096 count=1024                        
   1024+0 records in
   1024+0 records out
   4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.428427 s, 9.8 MB/s

Build Source Code

1. Get the bsp source code
 $ git clone
2. Build the bsp source code
Please read the source code

Advance Development


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

M2M BT bluetoothctl.png

WiFi Client

You have two ways to setup WiFi Client

1. Use commands to setup WiFi client

 $ sudo su
 # killall wpa_supplicant
 # wpa_passphrase <ssid> <passphrase> > /etc/wpa_supplicant/wpa_supplicant.conf              
 # ifconfig wlan0 up
 # iwlist wlan0 scan
 # wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf
 # dhclient eth0

There are some other command line ways, please google for them.

2. Use UI interface to setup WiFi Client


  • apt-get install xorg
  • apt-get install xserver-xorg
  • apt-get install xinit

NAS Application

1. Usb hub + sata to usb

  • HDD is supported

M2m connect hdd.png

M2m connect hdd cmd.png

  • SSD is supported

M2m connect ssd.png

M2m connect ssd cmd.png

Camara function

We use HDF5640 camara.

Ov5640 camara.png


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


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


Install Bpi-tools

Update Bpi-tools

  • Execute "bpi-tools"



Install RPi.GPIO

  • Execute "git clone"
  • after clone the repo, cd RPi.GPIO
  • Execute "sudo apt-get update"
  • Execute "sudo apt-get install python-dev python3-dev"
  • Execute "sudo python install" or "sudo python3 install" to install the module

Using RPi.GPIO

  • cd /usr/local/bin
  • Execute "./" to test RPi.GPIO

RPi GPIO.png


How to Update WiringPi

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

Update Pkglist.png

  • Execute "bpi-update -c bpi-pkg-bpi-wiringpi.conf"

Update WringPi.png

RGB 1602 LCD

  • Execute "/usr/local/bin/"

WringPi 1602 LCD m2m.png

0.96 Inch OLED Display

  • Execute "/usr/local/bin/"

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/"

WringPi LED Martix m2m.png