Configuration of the Development Environment
The Installment and Configuration of RT-Thread Studio
Access to the download page on the official website of RT-Thread to download the installation package of RT-Thread Studio at the bottom of the page.
As the current tool of RT-Thread Studio for V307 is old, the location of the tool chain of RT-Thread Studio should be modified to the gcc tool chain in the installation directory of MRS.
Step 3: Select the folder of voice control DEMO that has been downloaded and unzipped, and click Finish to complete the import of the project.
Step 5: Click
MCU -> RISC-V Toolchains Paths -> Browseto add the gcc tool chain in your computer's MRS installation directory as RT-Thread Studio tool chain.
Exporting RISC-V programming tools under WCH-Link
Since RT-Thread Studio does not integrate the V307 online debugging interface, you need to use the tools under MRS to download the program. MRS supports exporting the RISC-V programming tools under WCH-Link, and you can use the tools to download the program for V307 after exporting.
Note: For this DEMO program, it is better not to check the erase all. The last template of the chip Flash is used to store the voice feature vector, just erase it by page. If you encounter unsuccessful download, you can repeat it several times (the problem can be solved when the debugger program is unified and upgraded).
DEMO Programme Procedure Description
The program is composed of four parts: audio sampling thread, recognition thread, template training thread, LCD display thread, in which recognition thread and template training thread cannot run at the same time.
The ADC take analog voltage of PA1 port as sample. After the sampling is completed, the recognition thread is notified through an interrupt, and the recognition thread calculates the recognition result and transmits it to the LCD display. When the development board receives the
practice command from the serial port, it will run the template training thread. After it starts running, it will follow the serial port to output information for training and store it in the template library. Each keyword can correspond to multiple templates, the number of templates can be defined by the macro in the header file, and the default value is 2.
After the recognition mode starts to run, the content on the LCD screen is divided into three areas, namely the Logo area, the small red block moving area, and the recognition prompt area. You can modify the layout and logo at will. The default logo size is 80*60. When the recognition prompt area shows blue "speaking", you can say "up", "down", "left" or "right" to the microphone. If the recognition is successful, the prompt area will display the red "stop" and the current recognition result "result:xxx", and the small red block on the screen will also move in the corresponding direction.
Step 1: Connect the development board and use the WCH-Link RISC-V MCU download tool exported above to download the compiled voice control DEMO into the development board. The compiled voice control DEMO program is in the RT-Thread Studio project file Debug directory.
Step 2: Get into PuTTY the latest release on its official site to download putty tool for serial connection. After completing, double-click to open and then click
Serial. Set the certain connect port for development board (you can open the device manager after successfully connecting the development board for confirming the connect port), as well as setting the baud rate-115200. Lastly, click
open to open the serial terminal.
Step 3: After entering the terminal, click the RST button on the board to reset the development board. If shows the picture below, it means that the voice control DEMO has been successfully downloaded into the development board.
Step 5: When the blue "speaking" shows on the screen, you can say "up", "down", "left" or "right" to the microphone. If the recognition is successful, the screen will display red "stop" and the current recognition result "result:xxx". Meanwhile, the small red block on the screen will also move in the corresponding direction.