Banana Pi M2 Zero: First impressions and installing docker and octoprint

29-10-2020 - 13 minutes, 1 second -

This will be for sure the last time I buy a Banana Pi device. Searching for support online, I found out very quickly, AFTER buying the device, that Banana Pi has a reputation for dumping devices on to the market and then basically completely abandoning them, leaving support entirely up to the hacking community. Not only that but many times the hardware data is often copied and pasted from completely different devices into their device datasheets, so that you can't trust the data that comes from the manufacturer for your device. With that out of the way let's get to the goods.

I wanted something small and discrete but with a little more oomph than what the Raspberry Pi Zero W provides. The BPi-M2 Zero still has only 512 MB of memory, but comes with a quad core processor. It's the same size as the RPi which is what I wanted. After various frustrations and hair pulling with just getting the thing running correctly, I decided this would make an ideal octoprint server for my Ender 3 Pro. Here is the process I decided on to make that happen.

Download Armbian Bionic_current from here and burn to an mSD card (I recommend 8+ GB)

Adjust the armbian-firstrun-config.txt.template within the boot folder with your WiFi credentials and save removing the "template" portion. Insert the card into your device and plug in the power. The light will flash and then go dark. Watch your router interface for it to show up as connected then SSH as root and password as 1234. You'll go through the usual setup procedure. Then

sudo armbian-config
to bring you to the usual Armbian setup menu. Update firmware, adjust locale, etc.

After reboot, the red LED will blink when the Pi is running. Install docker engine via repository following this, making sure to choose armhf as the correct repository.

Add your user to the docker group:

sudo usermod -aG docker "user"
and either logout and in or reboot.

Next, you'll have to edit the kernel device tree. The reason is that you will need to map the micro USB port on the BPi as USB host instead of OTG as it currently is in order for it to recognize the printer. For this we will use the built in device tree compiler, dtc, to change the device tree binaries into something we can edit and recompile, a dts file.

Change to the device tree directory:

cd /boot/dtb
Backup the original binary:
sudo cp sun8i-h2-plus-bananapi-m2-zero.dtb sun8i-h2-plus-bananapi-m2-zero.dtb.bak
Convert the binary into a dts file so that we can edit it:
sudo dtc -I dtb sun8i-h2-plus-bananapi-m2-zero.dtb -O dts -o sun8i-h2-plus-bananapi-m2-zero.dts
Edit the file:
nano sun8i-h2-plus-bananapi-m2-zero.dts
Ctrl-W to search for dr_mode. Change "otg" to "host". Save and recompile:
dtc -I dts -O dtb -o sun8i-h2-plus-bananapi-m2-zero.dtb sun8i-h2-plus-bananapi-m2-zero.dts
Reboot

Install octoprint:

docker run -d --device /dev/ttyUSB0:/dev/ttyUSB0 -p 5000:5000 --name octoprint --restart always octoprint/octoprint

That's it. Run docker start octoprint if octoprint doesn't start automatically and go to your device address port 5000 and set up octoprint through the web interface.

Below is a benchamrking test for the Banana Pi M2 Zero

sbc-bench

sbc-bench v0.7.0 Banana Pi BPI-M2-Zero (Wed, 08 Apr 2020 00:31:36 -0500)

Distributor ID: Ubuntu Description: Ubuntu 18.04.4 LTS Release: 18.04 Codename: bionic

Armbian release info: BOARD=bananapim2zero BOARD_NAME="Banana Pi M2 Zero" BOARDFAMILY=sun8i BUILD_REPOSITORY_URL=https://github.com/armbian/rkbin BUILD_REPOSITORY_COMMIT=3e533c9 DISTRIBUTION_CODENAME=bionic DISTRIBUTION_STATUS=supported VERSION=20.02.4 LINUXFAMILY=sunxi BRANCH=current ARCH=arm IMAGE_TYPE=stable BOARD_TYPE=csc INITRD_ARCH=arm KERNEL_IMAGE_TYPE=Image

/usr/bin/gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0

Uptime: 00:31:36 up 3 min, 1 user, load average: 0.27, 0.16, 0.07

Linux 5.4.30-sunxi (bananapim2zero) 04/08/20 armv7l (4 CPU)

avg-cpu: %user %nice %system %iowait %steal %idle 4.78 0.02 2.85 0.22 0.00 92.13

Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn mmcblk0 17.38 665.34 5.63 131385 1112 zram0 3.41 3.61 10.05 712 1984 zram1 1.50 5.98 0.02 1180 4

          total        used        free      shared  buff/cache   available

Mem: 491M 69M 281M 2.3M 140M 409M Swap: 245M 0B 245M

Filename Type Size Used Priority /dev/zram1 partition 251676 0 5

##########################################################################

Checking cpufreq OPP:

Cpufreq OPP: 1008 Measured: 1005.982/1006.349/1005.578 Cpufreq OPP: 960 Measured: 957.573/957.496/956.531 Cpufreq OPP: 816 Measured: 813.170/813.210/813.781 Cpufreq OPP: 648 Measured: 646.805/645.692/646.157 Cpufreq OPP: 480 Measured: 477.643/477.719/478.464

##########################################################################

tinymembench v0.4.9 (simple benchmark for memory throughput and latency)

========================================================================== == Memory bandwidth tests == == == == Note 1: 1MB = 1000000 bytes == == Note 2: Results for 'copy' tests show how many bytes can be == == copied per second (adding together read and writen == == bytes would have provided twice higher numbers) == == Note 3: 2-pass copy means that we are using a small temporary buffer == == to first fetch data into it, and only then write it to the == == destination (source -> L1 cache, L1 cache -> destination) == == Note 4: If sample standard deviation exceeds 0.1%, it is shown in == == brackets ==

C copy backwards : 178.3 MB/s (0.1%) C copy backwards (32 byte blocks) : 525.3 MB/s C copy backwards (64 byte blocks) : 536.1 MB/s C copy : 534.7 MB/s C copy prefetched (32 bytes step) : 576.2 MB/s C copy prefetched (64 bytes step) : 589.2 MB/s C 2-pass copy : 524.9 MB/s C 2-pass copy prefetched (32 bytes step) : 556.4 MB/s C 2-pass copy prefetched (64 bytes step) : 573.3 MB/s C fill : 1534.3 MB/s C fill (shuffle within 16 byte blocks) : 1534.9 MB/s C fill (shuffle within 32 byte blocks) : 240.9 MB/s C fill (shuffle within 64 byte blocks) : 241.5 MB/s

standard memcpy : 397.4 MB/s standard memset : 1534.3 MB/s

NEON read : 884.1 MB/s NEON read prefetched (32 bytes step) : 1012.6 MB/s NEON read prefetched (64 bytes step) : 1004.6 MB/s NEON read 2 data streams : 263.5 MB/s NEON read 2 data streams prefetched (32 bytes step) : 495.1 MB/s NEON read 2 data streams prefetched (64 bytes step) : 510.2 MB/s NEON copy : 535.8 MB/s NEON copy prefetched (32 bytes step) : 550.5 MB/s NEON copy prefetched (64 bytes step) : 600.7 MB/s (0.3%) NEON unrolled copy : 527.8 MB/s NEON unrolled copy prefetched (32 bytes step) : 577.0 MB/s NEON unrolled copy prefetched (64 bytes step) : 587.2 MB/s NEON copy backwards : 525.6 MB/s NEON copy backwards prefetched (32 bytes step) : 550.6 MB/s NEON copy backwards prefetched (64 bytes step) : 587.9 MB/s NEON 2-pass copy : 528.2 MB/s NEON 2-pass copy prefetched (32 bytes step) : 573.3 MB/s NEON 2-pass copy prefetched (64 bytes step) : 580.7 MB/s NEON unrolled 2-pass copy : 520.5 MB/s NEON unrolled 2-pass copy prefetched (32 bytes step) : 507.8 MB/s NEON unrolled 2-pass copy prefetched (64 bytes step) : 517.7 MB/s NEON fill : 1534.5 MB/s NEON fill backwards : 1534.6 MB/s (1.6%) VFP copy : 530.3 MB/s VFP 2-pass copy : 518.3 MB/s ARM fill (STRD) : 1534.3 MB/s ARM fill (STM with 8 registers) : 1534.8 MB/s ARM fill (STM with 4 registers) : 1534.5 MB/s ARM copy prefetched (incr pld) : 598.7 MB/s ARM copy prefetched (wrap pld) : 540.3 MB/s ARM 2-pass copy prefetched (incr pld) : 563.1 MB/s ARM 2-pass copy prefetched (wrap pld) : 527.6 MB/s

========================================================================== == Memory latency test == == == == Average time is measured for random memory accesses in the buffers == == of different sizes. The larger is the buffer, the more significant == == are relative contributions of TLB, L1/L2 cache misses and SDRAM == == accesses. For extremely large buffer sizes we are expecting to see == == page table walk with several requests to SDRAM for almost every == == memory access (though 64MiB is not nearly large enough to experience == == this effect to its fullest). == == == == Note 1: All the numbers are representing extra time, which needs to == == be added to L1 cache latency. The cycle timings for L1 cache == == latency can be usually found in the processor documentation. == == Note 2: Dual random read means that we are simultaneously performing == == two independent memory accesses at a time. In the case if == == the memory subsystem can't handle multiple outstanding == == requests, dual random read has the same timings as two == == single reads performed one after another. ==

block size : single random read / dual random read 1024 : 0.0 ns / 0.0 ns 2048 : 0.0 ns / 0.0 ns 4096 : 0.0 ns / 0.0 ns 8192 : 0.0 ns / 0.0 ns 16384 : 0.0 ns / 0.0 ns 32768 : 0.0 ns / 0.0 ns 65536 : 6.3 ns / 10.8 ns 131072 : 9.6 ns / 15.1 ns 262144 : 11.4 ns / 16.8 ns 524288 : 15.2 ns / 21.7 ns 1048576 : 125.1 ns / 196.2 ns 2097152 : 187.3 ns / 260.0 ns 4194304 : 219.8 ns / 283.8 ns 8388608 : 237.4 ns / 295.4 ns 16777216 : 250.8 ns / 307.0 ns 33554432 : 264.4 ns / 326.1 ns 67108864 : 283.6 ns / 361.3 ns

##########################################################################

OpenSSL 1.1.1, built on 11 Sep 2018 type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes aes-128-cbc 18984.34k 23840.38k 25514.24k 25896.28k 26099.71k 26077.87k aes-128-cbc 19002.01k 23842.28k 25514.24k 25967.27k 26025.98k 26105.17k aes-192-cbc 16797.00k 20467.37k 21791.23k 22137.17k 22170.28k 22238.55k aes-192-cbc 16804.89k 20533.63k 21739.95k 22142.29k 22241.28k 22173.01k aes-256-cbc 15211.73k 18241.26k 19190.19k 19510.27k 19589.80k 19595.26k aes-256-cbc 15181.07k 18242.54k 19229.95k 19449.86k 19581.61k 19589.80k

##########################################################################

7-Zip (a) [32] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,32 bits,4 CPUs LE)

LE CPU Freq: 929 939 996 997 997 997 997 997

RAM size: 491 MB, # CPU hardware threads: 4 RAM usage: 450 MB, # Benchmark threads: 4

                   Compressing  |                  Decompressing

Dict Speed Usage R/U Rating | Speed Usage R/U Rating KiB/s % MIPS MIPS | KiB/s % MIPS MIPS

22: 437 100 426 425 | 9611 100 821 820 23: 425 100 434 434 | 9409 100 815 814 24: 412 100 444 444 | 9118 100 802 800 ---------------------------------- | ------------------------------ Avr: 100 435 434 | 100 812 812 Tot: 100 623 623

##########################################################################

7-Zip (a) [32] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,32 bits,4 CPUs LE)

LE CPU Freq: 965 949 946 997 998 997 998 998

RAM size: 491 MB, # CPU hardware threads: 4 RAM usage: 450 MB, # Benchmark threads: 4

                   Compressing  |                  Decompressing

Dict Speed Usage R/U Rating | Speed Usage R/U Rating KiB/s % MIPS MIPS | KiB/s % MIPS MIPS

22: 1249 326 373 1215 | 36140 396 779 3083 23: 1216 334 371 1239 | 32991 391 731 2855 24: 1127 336 361 1212 | 32189 393 720 2826 ---------------------------------- | ------------------------------ Avr: 332 368 1222 | 393 743 2921 Tot: 362 556 2072

7-Zip (a) [32] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,32 bits,4 CPUs LE)

LE CPU Freq: 997 997 998 998 998 998 998 998

RAM size: 491 MB, # CPU hardware threads: 4 RAM usage: 450 MB, # Benchmark threads: 4

                   Compressing  |                  Decompressing

Dict Speed Usage R/U Rating | Speed Usage R/U Rating KiB/s % MIPS MIPS | KiB/s % MIPS MIPS

22: 1181 321 358 1149 | 33713 393 732 2876 23: 1140 330 352 1162 | 32663 394 717 2826 24: 1113 337 355 1197 | 31238 393 697 2742 ---------------------------------- | ------------------------------ Avr: 330 355 1169 | 393 716 2815 Tot: 361 535 1992

7-Zip (a) [32] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,32 bits,4 CPUs LE)

LE CPU Freq: 837 807 807 866 998 998 998 998

RAM size: 491 MB, # CPU hardware threads: 4 RAM usage: 450 MB, # Benchmark threads: 4

                   Compressing  |                  Decompressing

Dict Speed Usage R/U Rating | Speed Usage R/U Rating KiB/s % MIPS MIPS | KiB/s % MIPS MIPS

22: 1147 319 350 1116 | 32834 394 712 2801 23: 1126 328 350 1148 | 32083 394 704 2776 24: 1111 337 354 1195 | 30534 390 687 2681 ---------------------------------- | ------------------------------ Avr: 328 352 1153 | 393 701 2753 Tot: 360 526 1953

Compression: 1222,1169,1153 Decompression: 2921,2815,2753 Total: 2072,1992,1953

##########################################################################

Testing clockspeeds again. System health now:

Time CPU load %cpu %sys %usr %nice %io %irq Temp 00:47:29: 816MHz 3.58 88% 2% 85% 0% 0% 0% 81.1°C

Checking cpufreq OPP:

Cpufreq OPP: 1008 Measured: 1003.990/1004.893/1005.174 Cpufreq OPP: 960 Measured: 959.263/958.039/957.418 Cpufreq OPP: 816 Measured: 813.160/814.422/813.120 Cpufreq OPP: 648 Measured: 640.911/644.378/641.806 Cpufreq OPP: 480 Measured: 472.676/474.723/474.856

##########################################################################

System health while running tinymembench:

Time CPU load %cpu %sys %usr %nice %io %irq Temp 00:31:41: 1008MHz 0.33 8% 2% 5% 0% 0% 0% 53.3°C 00:33:41: 1008MHz 0.98 25% 0% 25% 0% 0% 0% 65.0°C 00:35:41: 1008MHz 1.00 25% 0% 24% 0% 0% 0% 63.6°C 00:37:41: 1008MHz 1.00 25% 0% 25% 0% 0% 0% 65.5°C

System health while running OpenSSL benchmark:

Time CPU load %cpu %sys %usr %nice %io %irq Temp 00:38:59: 1008MHz 1.00 19% 0% 18% 0% 0% 0% 65.7°C 00:39:10: 1008MHz 1.00 25% 0% 25% 0% 0% 0% 66.6°C 00:39:20: 1008MHz 1.00 25% 0% 24% 0% 0% 0% 66.4°C 00:39:30: 1008MHz 1.00 25% 0% 25% 0% 0% 0% 66.4°C 00:39:40: 1008MHz 1.00 25% 0% 24% 0% 0% 0% 66.1°C 00:39:50: 1008MHz 1.00 25% 0% 25% 0% 0% 0% 66.5°C 00:40:00: 1008MHz 1.00 25% 0% 25% 0% 0% 0% 66.2°C 00:40:10: 1008MHz 1.00 25% 0% 24% 0% 0% 0% 66.7°C 00:40:20: 1008MHz 1.00 25% 0% 25% 0% 0% 0% 66.6°C 00:40:30: 1008MHz 1.00 25% 0% 24% 0% 0% 0% 66.6°C 00:40:40: 1008MHz 1.00 25% 0% 25% 0% 0% 0% 67.0°C

System health while running 7-zip single core benchmark:

Time CPU load %cpu %sys %usr %nice %io %irq Temp 00:40:48: 1008MHz 1.00 20% 0% 19% 0% 0% 0% 66.6°C 00:41:48: 1008MHz 2.36 25% 0% 24% 0% 0% 0% 66.4°C 00:42:48: 1008MHz 2.86 25% 0% 24% 0% 0% 0% 67.0°C 00:43:48: 1008MHz 2.35 25% 1% 24% 0% 0% 0% 67.6°C

System health while running 7-zip multi core benchmark:

Time CPU load %cpu %sys %usr %nice %io %irq Temp 00:44:00: 1008MHz 2.72 21% 0% 20% 0% 0% 0% 67.6°C 00:44:21: 1008MHz 2.76 78% 1% 76% 0% 0% 0% 78.8°C 00:44:41: 1008MHz 2.91 83% 2% 81% 0% 0% 0% 79.6°C 00:45:03: 816MHz 3.21 88% 2% 85% 0% 0% 0% 77.9°C 00:45:23: 1008MHz 3.09 81% 3% 78% 0% 0% 0% 79.3°C 00:45:43: 816MHz 3.08 85% 2% 83% 0% 0% 0% 81.0°C 00:46:03: 816MHz 3.26 80% 2% 78% 0% 0% 0% 79.3°C 00:46:24: 816MHz 3.10 81% 2% 79% 0% 0% 0% 81.4°C 00:46:44: 1008MHz 3.26 85% 2% 82% 0% 0% 0% 82.2°C 00:47:04: 1008MHz 3.17 82% 2% 80% 0% 0% 0% 81.4°C 00:47:29: 816MHz 3.58 88% 2% 85% 0% 0% 0% 81.1°C

Throttling statistics (time spent on each cpufreq OPP):

1008 MHz: 860.01 sec 960 MHz: 0 sec 816 MHz: 88.92 sec 648 MHz: 0 sec 480 MHz: 0 sec

##########################################################################

Linux 5.4.30-sunxi (bananapim2zero) 04/08/20 armv7l (4 CPU)

avg-cpu: %user %nice %system %iowait %steal %idle 31.74 0.02 1.18 0.05 0.00 67.01

Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn mmcblk0 3.67 130.71 1.79 151037 2068 zram0 0.60 0.63 1.77 728 2040 zram1 13.25 4.01 49.01 4628 56632

          total        used        free      shared  buff/cache   available

Mem: 491M 115M 350M 132K 25M 365M Swap: 245M 30M 215M

Filename Type Size Used Priority /dev/zram1 partition 251676 31488 5

Architecture: armv7l Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 Vendor ID: ARM Model: 5 Model name: Cortex-A7 Stepping: r0p5 CPU max MHz: 1008.0000 CPU min MHz: 480.0000 BogoMIPS: 48.00 Flags: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm