8.1 Set up MaixPy environment
1.1 What is MaixPy?
MaixPy is a project transplanted Micropython into K210 (a 64 - bit dual-core with hardware FPU, convolution accelerator, FFT, Sha256 of RISC-V CPU), supporting MCU regular operations, it also incorporates hardware acceleration AI machine vision and a microphone array, 1TOPS computing power core module is less than ￥50, which quickly develops very low cost and volume of practical AIOT field of smart applications.
The first thing you need to know is Maixpy uses MicroPython scripting syntax, so it doesn't require compilation like C language, it can be used without an IDE: using the serial terminal tool which has been installed previously.
Using IDE, you can edit scripts in real time on the computer and upload them to the development board，which is convenient to execute scripts directly on the development board, view camera images in real time on the computer, save files to the development board and so on.
However, using an IDE will compress and transport some resources, so the performance will be reduced, and if MaixPy goes down, it’s hard to find problems like serial terminal.
For more information, please click official websiteto view the official instructions.
1.2 What can MaixPy be used for?
- Face Recognition
- Object Recognition
- Color Identification
- Emotion Recognition
- License Plate Recognition
- Sorting System
For more information, please clickofficial websiteto view the official instructions.
2.How to set up the usage environment?
2.1 Preparation of the development environment
2.1.1 Install Driver
- Before using MaixPy, we need to install the serial driver before we can proceed to the next step of development and use. The board is connected to the computer via a USB-to-serial device (K210 does support USB hardware), please install the driver according to the USB to serial port chip model of the board.
- Click to download and installthe serial driver
- When operating a serial port on Linux or Mac, if you don't want to use “sudo” every time, perform “sudo usermod -a -G dialout $(whoami)” to add yourself to the “dialout” user group, which may require a logout or reboot.
2.1.2 Burn Firmware
- The firmware must be V0.3.1 or above to use the MaixPy IDE, otherwise the MaixPy IDE will not be connected. Try to check the firmware version and IDE version before use, and update it to the latest version to ensure normal use.
- Click to download the firmware burner Kflsh , a compressed package after downloading.
Kflash_gui is cross-platform and can be used on multiple systems (including Windows, Linux, MacOS, and even Raspberry Pi).
Windows version of Kendryte may be unable to download. Please use the software kflash_gui to download.
- Click to download and installfirmware
- Burn firmware
After downloading, use the firmware burner to burn the firmware to M5StickV:
2.2 Download and install software
2.2.1 Click to download MaixPy-IDE
Note: Please refer to the readme.txt file in the latest version folder for the list of files. If the download speed is slow, please use the cdn link to download.
Download the file, directly double-click the exe file to run the installation program in Windows
Open MaixPy IDE and select the model of the development board from the top toolbar. Select M5Stickv to connect.
Tool-> Select Board (Tools -> Select Development Board)
Click “connect” to connect MaixPy IDE
When the connection is successful, it will change from green to red.
Below the connect button is the run button, which executes the py file in the current edit area.
Click the Run button again (red) to stop running the current code.
3. Troubleshooting Guide of USB Serial Port
If you do not see a serial port, check for hardware problems in the following order.
- Insert the computer, whether there is a ding-dong sound, such as the sound of the USB drive loading when inserting the U disk. If there isn’t, it means that there is a problem with the serial chip on the hardware.
- Replace the cable and try again. Replace the USB port of the computer and try again. It still won't load out, change the computer to confirm.
If you cannot burn firmware, check for hardware problems in the following order.
- Use the serial port tool to see if the MAIXPY firmware exists in the hardware.
- Set 115200 baud rate to connect the serial port, press the reset key (RST) to receive the data of the chip. Whatever it happens means the serial port chip is working normally, but if there is nothing, it means the hardware is abnormal.
- Based on the above, burn the firmware again. Before burning, press the BOOT key of the hardware and press reset, and then release the BOOT key, which means the burning is processing normally. If not, it means that Flash is damaged, you can try to burn to SRAM. If the burning fails, it means that the serial port chip is abnormal.
- If you get to this step and still can't fix the problem, then the hardware does have a defect.
3.1 Burning mechanism introduction of K210
We often call this a key download circuit, can easily complete the control of BOOT and RST pin and enter the burning mode through the control of the serial port RST and DTR. As described above, the hardware circuit is expected to replace human to automatically perform the operation of pressing RST and BOOT, which is strongly dependent on hardware implementation. Only based on this can data transmission of TX and RX be carried out, so we need to use functional pins of UART serial port.
Kflash can be divided into a variety of versions of a variety of burning triggers. We can simply divide it into several categories, 115200 baud rate at low speed and 1500000 baud rate at high speed, taking the matching burning mode of these two types of baud rate as the difference point.
If it is found that the download process fails, the baud rate can be reduced appropriately, because the serial port chip is not stable. The selection of the type in the tool will only affect the trigger of the first burning mode, and after that the burning firmware will be burned at the configured baud rate, usually not exceed the communication burning speed with flash, commonly seen in 50~60 KB/S.
If you find that no matter how to replace the burning mode can not enter, either the burning version does not match, or the serial chip DTR RST pin problem (physical).