The Bitmain SophonTM Edge Developer Board(EDB) is designed for bringing powerful Deep Learning capability to various type of applications through its quick prototype development. Sophon Edge Developer Board is powered by BM1880, which equips tailored TPU supporting DNN/CNN/RNN/LSTM operations and models. The edge developer board is compatible with Linaro 96boards while supporting modules for Arduino and Raspberry Pi. Developers can leverage off-the-shelf modules and develop cutting edge DL/ML applications, like facial detection and recognition, facial expression analysis, object detection and recognition, vehicle license plate recognition, voiceprint recognition, etc.
Product Features
Supports DNN/CNN/RNN/LSTM models profiling, compiling and tuning
Real-time inference in edge device
Quickly deploy existing DNN/CNN/RNN/LSTM models or uniquely trained networks
Features Bitmain SophonTM BM1880 with energy efficient DNN/CNN/RNN/LSTM processing
Compatible to 96Boards Consumer Edition Spec.
Support Caffe, ONNX, Pytorch, Tensorflow framework
BMNet: Bitmain Compiler which can convert supported AI models to internal format accelerated by Sophon TPU.
ONNX: Compiler which can convert ONNX format to internal format accelerated by Sophon TPU.
Quantization Tool: Convert FP32 to INT8 and support calibration function
Get Started
Edge Developer Board(EDB) is designed to work in two mode, we called it USB mode and SoC mode.
Setup the Edge Developer Board(EDB) by following the steps provided below.
USB Mode
Step 1: Prepare Your Equipment
In USB mode, Edge Developer Board(EDB) as a USB device role, BMNNSDK is installed on the X86 host, and calling EDB’s computing for deep learning, the environment requirement are as follows.
Hardware environment: X86_64 host with usb port
Bitmain SophonTM Edge Developer Board(EDB)
Operating system: Ubuntu* 16.04 operating system, or Ubuntu VMware instance
Bitmain Sophon Neural Network Software Development Kit (SDK), such as bmtap2-bm1880-usb-x.y.z.tar.gz , you can download the compression package from https://www.sophon.cn/drive/36.html
Set the DIP switch to bit[1:8]=11000001 to config the usb port work in device mode.
To uninstall the BMNNSDK ,simply execute the uninstall script in the installation directory.
$sudo/opt/bmtap2/bm1880-usb-x.y.z/uninstall.sh
Step 3: Basic function testing
The Basic function testing use the network model and data include in the installation package for Neural Network inference, the test results will be output to the out subdirectory of the current directory, please make sure that the user has the write rights to the current directory.
# run_test_bmnet_bm1880
begin to test net: mtcnn det1 <1,3,12,12>
<CMD> test_bmnet_bmodel /opt/bmtap2/bm1880-usb_1.0.1/test/../models/mtcnn/det1_input_1_3_12_12.bin /opt/bmtap2/bm1880-usb_1.0.1/test/../models/mtcnn/det1_1_3_12_12.bmodel out//det1_output.bin 1 3 12 12
input size: 432
WARNING: Logging before InitGoogleLogging() is written to STDERR
I1026 19:41:03.865362 2635 bm_firmware.cpp:76] check firmware status ...
I1026 19:41:03.865628 2635 bm_firmware.cpp:82] firmware loading ...
I1026 19:41:03.929674 2635 bm_firmware.cpp:47] firmware load success
I1026 19:41:08.937716 2635 bm_firmware.cpp:98] firmware is running
I1026 19:41:08.937757 2635 bm_device.cpp:104] device[0] opened,gmem_size : 0x40000000
output size:6
outputs[0]: [1,4,1,1], "conv4-2"
outputs[1]: [1,2,1,1], "conv4-1"
test_bmnet_bmodel: load 107 us, run 106 us, read 76 us
('/opt/bmtap2/bm1880-usb_1.0.1/test/../models/mtcnn/det1_output_1_3_12_12_ref.bin', ' vs. ', 'out//det1_output.bin')
Result matched @ epsilon = 0.000000
det1<1,3,12,12> passed
begin to test net: mobilenet mobilenet <1,3,224,224>
<CMD> test_bmnet_bmodel /opt/bmtap2/bm1880-usb_1.0.1/test/../models/mobilenet/mobilenet_input_1_3_224_224.bin /opt/bmtap2/bm1880-usb_1.0.1/test/../models/mobilenet/mobilenet_1_3_224_224.bmodel out//mobilenet_output.bin 1 3 224 224
input size: 150528
WARNING: Logging before InitGoogleLogging() is written to STDERR
I1026 19:41:09.092887 2662 bm_firmware.cpp:76] check firmware status ...
I1026 19:41:09.093133 2662 bm_firmware.cpp:85] firmware is running
I1026 19:41:09.093152 2662 bm_device.cpp:104] device[0] opened,gmem_size : 0x40000000
output size:1000
outputs[0]: [1,1000,1,1], "fc7"
test_bmnet_bmodel: load 3773 us, run 2820 us, read 222 us
('/opt/bmtap2/bm1880-usb_1.0.1/test/../models/mobilenet/mobilenet_output_1_3_224_224_ref.bin', ' vs. ', 'out//mobilenet_output.bin')
Result matched @ epsilon = 0.000000
mobilenet<1,3,224,224> passed
test_bmnet_bm1880 success
SoC Mode
Step 1: Prepare Your Equipment
In SoC mode, EDB works as a host role, BMNNSDK is installed on the BM1880 Edge Developer Board(EDB), use the computing resources on the BM1880 SoC board to accelerate the deep learning calculation.
and now, BMNNSDK soc mode had included in bm1880-system-sdk, while you setup the linux environment finished, the BMNNSDK soc mode installed also.
Step 3: Basic function testing
The Basic function testing use the network model and data include in the installation package for Neural Network inference, the test results will be output to the out subdirectory of the current directory, please make sure that the user has the write rights to the current directory.
copy bmtap2-bm1880-soc_basic_test folder to rootfs of bm1880 edge development board, and then
ldconfig
cd /system/data
./load_driver.sh
cd bmtap2-bm1880-soc_basic_test/test
./test_bmnet.sh
The test results are as follow:
./test_bmnet.sh
BMNET_OUT_PATH = out/
begin to test net: mtcnn det1 <1,3,12,12>
<CMD> ../bin/test_bmnet_bmodel /workspace/bmtap2-bm1880-soc_1.0.3.1/test/../models/mtcnn/det1_input_1_3_
Runtime Version : [1.0.3]
input size: 432
output size:6
outputs[0]: [1,4,1,1], "conv4-2"
outputs[1]: [1,2,1,1], "conv4-1"
test_bmnet_bmodel: load 5 us, run 85 us, read 9 us
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0101 09:18:24.895155 360 bm_device_soc.cpp:216] device[0] closed
*** Similarity: 1.0 (6/6)
det1<1,3,12,12> passed
begin to test net: mobilenet mobilenet <1,3,224,224>
<CMD> ../bin/test_bmnet_bmodel /workspace/bmtap2-bm1880-soc_1.0.3.1/test/../models/mobilenet/mobilenet_i
Runtime Version : [1.0.3]
input size: 150528
output size:1000
outputs[0]: [1,1000,1,1], "fc7"
test_bmnet_bmodel: load 114 us, run 2566 us, read 11 us
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0101 09:18:24.947519 362 bm_device_soc.cpp:216] device[0] closed
*** Similarity: 1.0 (1000/1000)
mobilenet<1,3,224,224> passed
test_bmnet_bm1880 success
Setup EDB's Linux SDK
Following steps will show you how to get, build the bm1880 system SDK, and also give you the instructions to download the image to board.
To download the latest version of the bm1880 system sdk , please visit the website below:
2. And follow the README.md file to build the bm1880 system sdk, you can get the eMMC boot Images and SD card boot images while the source code built successfully. And then you can start to download the images you built to the bm1880 Edge Development Board(EDB).
BM1880 Edge Development Board(EDB) can support two boot modes and you can select it by setting the switch on board
Boot Modes
EDB supports SD boot, eMMC boot, Boot modes can be selected by setting the switch SW1
BOOT_SEL[1:8] = 10100010: EDB boot the system SDK from SD card.
BOOT_SEL[1:8] = 10000010: EDB boot the system SDK from eMMC.
SD Boot
(1) Get the Images for SD boot
You can see the following files in your bm1880-system-sdk folder while you build the source code succesfully. For SD boot mode, you will use fip.bin, rootfs and sdboot.itb.
You need prepare one TF-card, maybe you need a TF-card reader to insert the TF-card to you ubuntu16.04 PC.
Before insert TF-card to your ubuntu16.04 x86_64 pc, you can have a check:
ls/dev/sd*/dev/sda
After insert it in your pc, check it again
ls/dev/sd*/dev/sda/dev/sdc/dev/sdc1
You can find the device node of your TF-card, name is /dev/sdc, now we can start to format the TF-card to two partitions we need.
$ sudo apt install expect
$ cd ./bm1880-system-sdk/build/sd_tools/
$ sudo ./sd_creat_rootfs_sd.sh /dev/sdc
umount /dev/sdc*
umount: /dev/sdc: not mounted
args: /dev/sdc +128M +3072M
spawn fdisk /dev/sdc
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Partition number (1,2, default 2):
Partition 2 has been deleted.
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): d
No partition is defined yet!
Could not delete partition 1
Command (m for help): o
Created a new DOS disklabel with disk identifier 0x9bbd8a4f.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-124735487, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-124735487, default 124735487): +128M
Created a new partition 1 of type 'Linux' and of size 128 MiB.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2):
First sector (264192-124735487, default 264192):
Last sector, +sectors or +size{K,M,G,T,P} (264192-124735487, default 124735487): +3072M
Created a new partition 2 of type 'Linux' and of size 3 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
mkfs.vfat /dev/sdc1
mkfs.fat 3.0.28 (2015-05-16)
mlabel -i /dev/sdc1 ::IMAGES
mkfs.ext4 /dev/sdc2 -F
mke2fs 1.42.13 (17-May-2015)
/dev/sdc2 contains a ext4 file system labelled 'rootfs'
last mounted on /media/hinton/rootfs on Sat Mar 9 10:59:03 2019
Creating filesystem with 786432 4k blocks and 196608 inodes
Filesystem UUID: 8b6ee338-bd57-4ca8-b6b1-2821b9f8d3a1
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
e2label /dev/sdc2 rootfs
Run commands to check whether the partitions are correct, it is correct when you see the directories named IMAGES and rootfs.
$ sudo fdisk -l /dev/sdb
/dev/sdc1 on /media/[your user name]/IMAGES type vfat
/dev/sdc2 on /media/[your user name]/rootfs type ext4
Unplug the TF-card from you pc and insert it to bm1880 edge development board.
Select boot mode as SD boot by setting the DIP switch to 10100010, the state ON means 1.
Connect the UART cable to pc to watch the boot log and visit linux shell on bm1880 edge development board
Install minicom as the terminal to watch log and run shell commands on EDB.
$ sudo apt-get install minicom
$ sudo gedit /etc/minicom/minirc.dfl
// config to this:
# Machine-generated file - use "minicom -s" to change parameters.
pu port /dev/ttyUSB0
pu rtscts No
$ sudo minicom
Welcome to minicom 2.7
OPTIONS: I18n
Compiled on Nov 15 2018, 20:18:47.
Port /dev/ttyUSB0, 11:23:16
Press CTRL-A Z for help on special keys
Power on the board you will see the boot log
NOTICE: Locate FIP in SD FAT
NOTICE: Locate FIP in SD FAT
NOTICE: BL1: Booting BL31
NOTICE: BL31: bm1880_asic:v1.4(release):g4ab24be
NOTICE: BL31: Built : 17:10:58, Mar 6 2019
U-Boot 2017.07 (Mar 09 2019 - 11:58:04 +0800) bitmain_bm1880
DRAM: 236 MiB
Relocation Offset is: 06b5c000
Relocating to 10eb5c000, new gd at 10e2dbe10, sp at 10e2d97e0
MMC: sdhc@50100000: 0, sdhc@50101000: 1
Using default environment
In: serial
Out: serial
Err: serial
Net: phy detected at ADDR 1
Warning: ethernet@58008000 (eth0) using random MAC address - f6:0b:fc:22:08:56
eth0: ethernet@58008000
Hit any key to stop autoboot: 0
....
[ 15.047187] [0] usb 2-1: new SuperSpeed USB device number 2 using xhci-hcd
[ 15.072192] [0] hub 2-1:1.0: USB hub found
[ 15.076348] [0] hub 2-1:1.0: 4 ports detected
[ 15.191160] [0] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[ 15.336198] [0] hub 1-1:1.0: USB hub found
[ 15.340356] [0] hub 1-1:1.0: 4 ports detected
[ 15.631158] [0] usb 1-1.4: new high-speed USB device number 3 using xhci-hcd
[ 15.869389] [1] Bluetooth: hci0: rtl: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8821
[ 15.878358] [1] Bluetooth: hci0: rtl: loading rtl_bt/rtl8821a_config.bin
[ 15.889757] [1] Bluetooth: hci0: rtl: loading rtl_bt/rtl8821a_fw.bin
[ 15.901374] [1] Bluetooth: hci0: rom_version status=0 version=1
[ 15.
Access linux shell on EDB
[ 15.907350] [1] Bluetooth: cfg_sz 10, total size 21678
/ #
/ #
/ # ls
bin init_kdump.sh linuxrc sbin
dev init_ramboot.sh lost+found sys
etc init_recovery.sh mnt system
home init_roboot.sh proc tmp
init init_sdboot.sh root usr
init_emmcboot.sh lib run var
/ #
eMMC Boot
(1) Get the Images for eMMC boot
You can see the following files in your bm1880-system-sdk folder while you build the source code succesfully. For eMMC boot mode, you will use these files in the directiory of bm1880_emmc_dl_v1p1 .
4. Connect the USB male to male cable between ubuntu16.04 pc and the OTG usb port on your EDB. You can see the log for eMMC downloading:
USB VID:PID=30B1:1000 SER=123456789ABC LOCATION=1-1
bm_dl_magic.bin is 128 bytes
Send to address 0x4003000
--- 0.0 Seconds ---
Done
Sending prg.bin...
prg.bin is 82296 bytes
Send to address 0x4003000
--- 3.2 Seconds ---
Done
Jumping to prg.bin...
/dev/ttyACM1BM1880 USB port: |
USB VID:PID=30B1:1000 SER=123456789ABC LOCATION=1-1
Done
Sending FIP.bin...
fip.bin is 475483 bytes
Send to address 0x8003000
--- 3.42 Seconds ---
Done
Downloading FIP.bin to eMMC then reboot to uboot...
/dev/ttyACM0BM1880 USB port: /
USB VID:PID=30B1:1001 SER=123456789ABC LOCATION=1-1
Done
Sending ramboot_mini.itb...
ramboot_mini.itb is 8257058 bytes
Send to address 0x10f100000
--- 1.63 Seconds ---
Done
Booting linux in ramboot_mini.itb...
Doneing for BM1880 USB port: /
Sending emmc.tar.gz...
emmc.tar.gz is 224985262 bytes
Send to address 0x4003000
--- 9.75 Seconds ---
Done
Processing emmc.tar.gz and then reboot...
It takes about 120 seconds, please wait...
--- 168.44 Seconds ---
5. Re-power on the EDB, you will see the boot log from terminal(how to use terminal to watch log pealse see the section SD Boot)
Make sure the step 4 AFTER step 3.
Note 2: (Ubuntu18.04 ONLY, JUST DO IT ONCE):
Please add Bitmain USB PID/VID to filter list of modem manager using the following command: