[EN] Hi, MaixPy

This article introduces the features of the Sipeed M1w dock suit board, which is a board designed to process AI on edge devices, enabling IoT applications to support artificial intelligence computing by using the KPU K210 chip as the core of computing.

(Figure. 1)

Properties

The Sipeed M1w dock suit consists of both hardware and software architecture designed to solve AI (Artificial Intelligence) functional problems, enabling edge devices to process artificial intelligence without the need for cloud technology. It can run algorithms on predictive maintenance, anomaly detection, machine vision, robotics, voice recognition and more, enabling a wide range of applications in the industry, Health equipment or various intelligent systems.

This board requires DC power at 3V3 and a use USB-C header cable to connect to the board.

(Figure. 2)
(Figure. 3)
(Figure. 4)
(Figure. 5)

Maix’s processor

  1. The processor was RISC-V architecture designed to be the artificial intelligence chip model KPU K210.
  2. The processor was a 64-bit dual-core RISC-V processor running at 400MHz and accelerated up to 800MHz.
  3. Equipped with a high-speed RAM of 8 MB capacity.
  4. It has 64 KPU (Neural Network Processor) units that support 576-bit neural network processing. Support for convolution, uses 0.3W of power at a 400MHz clock frequency, enabling images to be processed around 60 frames per second (fps) when using VGA-type images.
  5. It has an APU (Audio Processor) processor, supports up to 8 microphones, a sampling rate of 192KHz, built-in FFT calculation unit.
  6. FPIOA that can be set to 255 operations for 48 active pins (GPIOs).
  7. Support DVP cameras and LCD mounting.
  8. AES, SHA256, FFT accelerator units are available.
  9. Support OTP, UARTx4, WDT, I2Cx2, SPIx4, I2Sx3, TIMERx3 (32 bit), RTC, PWM.
  10. 8 Mbs of ROM available
  11. There is a WiFi module from the ESP8285 chip and the antenna can be installed separately from the board.
  12. Can read FAT file systems via microSD-Card Reader.
(Figure. 6)
(Figure. 7)
(Figure. 8)

Software development

The software for MAix M1w dock boards can be developed in various ways:

  1. An SDK or C/C++ development kit built on top of FreeRTOS via Arduino IDE or PlatformIO.
  2. Python programming with Micropython which was optimized for MAix boards, called maixPy, supports FPIOA, GPIO, TIMER, PWM, Flash, OV2640 and onboard LCDs, and can write/edit onboard python code via maixpy IDE.
  3. kflash_gui required for firmware updating.
  4. Deep learning fixed-point model can be performed, allowing trains, creating rules, and having the train/rule model compiler to become the desired model.
  5. Deep Learning supports Tiny-yolo, mobilenet-v1, TensorFlow Lite, specifically TensorFlow Lite can be compiled and run directly on MAIX.
(Figure. 9 maixPy IDE)
(Figure. 10 kflash GUI)
(Figure. 11)

Example program code11-1 reads board data which reports board platform as MaixPy version 3.4.0. , 518144 bytes of memory available (as for more than this value will be used for camera and AI buffers), uses firmware version 0.5.1. The board is Sipeed_M1 that uses the kendryte-k210 processor and shows the frequency of the CPU clock and KPU.

# code11-1, By: JarutEx - Fri Oct 16 2020

import sensor, image, time, lcd, os, sys, gc
from machine import I2C
import machine as mc
import Maix

i2c = I2C(I2C.I2C0, freq=100000, scl=28, sda=29)
uname = os.uname()

mem_total = gc.mem_alloc()+gc.mem_free()
free_percent = str((gc.mem_free())/mem_total*100.0)+"%"
alloc_percent = str((gc.mem_alloc())/mem_total*100.0)+"%"
print("ID .............: {}".format(mc.unique_id()))
print("Platform .......: {}".format(sys.platform))
print("Version ........: {}".format(sys.version))
print("Memory")
print("   total .......: {} Bytes or {} MBytes".format(mem_total, mem_total/(1024*1024)))
print("   usage .......: {} Bytes or {}".format(gc.mem_alloc(),alloc_percent))
print("   free ........: {} Bytes or {}".format(gc.mem_free(),free_percent))
print("system name ....: {}".format(uname.sysname))
print("node name ......: {}".format(uname.nodename))
print("release ........: {}".format(uname.release))
print("version ........: {}".format(uname.version))
print("machine ........: {}".format(uname.machine))
print("CPU Frequency ..: {} MHz".format(Maix.freq.get()[0]))
print("KPU Frequency ..: {} MHz".format(Maix.freq.get()[1]))
if i2c != None:
    devices = i2c.scan()
    i2c_dev = {32:'PCF8574',33:'PCF8574',34:'PCF8574',35:'PCF8574',36:'PCF8574',37:'PCF8574',38:'PCF8574',39:'LCD',56:'LCD',57:'PCF8574',58:'PCF8574',59:'PCF8574',60:'PCF8574/OLED',61:'PCF8574',62:'PCF8574',63:'PCF8574',68:'SHT31', 84:'24xx #1',85:'24xx #2',86:'24xx #3',87:'24xx #4',104:'RTC'}
    if len(devices)==0:
        print("No I2C")
    for io in devices:
        if io in i2c_dev:
            print("Address [",hex(io),"] Device :",i2c_dev[io])
        else:
            print("Address [",hex(io),"] Device : ???")

lcd.init(freq=15000000)
lcd.rotation(2)

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)

img = sensor.snapshot()
lcd.display(img)
sensor.shutdown(0)
(Figure. 12 result of code11-1)

Example code11-2, opens the camera and searches for an object that is green and creates a frame around that object.

# code11-2 - By: JarutEx - Fri Oct 16 2020
import sensor, image, time, lcd

lcd.init(freq=15000000)
lcd.rotation(2)

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)

clock = time.clock()

while(True):
    clock.tick()
    img = sensor.snapshot() # Capture
    #process
    green_threshold = (0,   80,  -70,   -10,   -0,   30)
    blobs = img.find_blobs([green_threshold])
    if blobs:
        for b in blobs:
            tmp=img.draw_rectangle(b[0:4])
            tmp=img.draw_cross(b[5], b[6])
            c=img.get_pixel(b[5], b[6])
    #display
    lcd.display(img)
    print(clock.fps())
(Figure. 13 result of code11-2)

Conclusion

In this article, we got to know the features of the maix board for an overview of board usability. In addition, we have also learned of software development tools download sources for further learning of artificial intelligence programming.

If you want to discuss something, feel free to leave comments below.

(C) 2020, Jarut Busarathid and Danai Jedsadathitikul
Updated 2021-05-09