SDK Quick Start¶
1. Overview¶
This is a quick development manual for the CI130X Software Development Kit ( SDK ), designed to help developers develop code quickly.
2. User guide¶
2.1. Development environment¶
Here are the software and hardware needed in the development process :
- IDE Development Software
- CI130X SDK
- Serial port upgrade tool
2.1.1. IDE development software¶
All applications in the SDK can be compiled and used through the common vscode tool. Users can refer to the document☞《compilation software installation and use》for installation, or can download it to the ☞Chipintelli Speech AI Development Platform database.
2.1.2. CI130X SDK software package¶
The SDK includes sample projects, documents, and necessary tools, which can be downloaded from ☞Chipintelli Speech AI Development Platform database.
2.1.3. Serial upgrade tool¶
Our company provides a serial port upgrade tool PACK _ UPDATE _ TOOL.exe used by CI130X chip for burning and upgrading firmware. About serial port upgrade steps see chapter 4 burning.
2.2. Development board introduction¶
The CI130X standard development board CI-D06GT01D is taken as an example to introduce the hardware. Users can purchase the development board a ☞sample purchase.
2.2.1. Development board physical map¶
Model : CI-D06GT01D(main chip CI130X).
2.2.2. Introduction to development board¶
- The hardware diagram of CI-D06GT01D development board is as follows.
-
1: TYPE-C data interface, which can be used for power access and serial port upgrade.
-
2: Input power 5V, GND and switch keys.
-
3: Use serial port UART0 to upgrade firmware_ TX and UART0_ RX, this pin needs to be short circuited when upgrading with TYPE-C.
-
4: Microphone base.
-
5: Horn base.
-
6: Reset button. During the upgrade process, you need to press the reset button to start the upgrade.
3. Applications¶
At present, a set of SDK has been provided for CI130X: CI130X_ SDK (Offline Speech Recognition SDK).
3.1. Introduction to SDK overall architecture¶
File name | Effect |
---|---|
components | The directory is a component, including player, ASR identification, key, sensor, FreeRTOS operating system, etc |
driver | The directory includes CI130X chip bottom driver, board level support configuration |
libs | Directory includes lib files |
projects | The catalog includes sample projects |
startup | The directory contains the CI130X startup code |
system | The directory includes system related codes, interrupt handler files, and platform related configurations |
tools | Tool catalog, mainly for merging, packaging and upgrading tools |
3.2. CI130X_SDK sample project introduction¶
To help developers create applications quickly, CI130X_ A sample project has been created in the SDK. By learning the sample project, developers can easily become familiar with the SDK.
Example project path: CI130X_SDK\projects\
Engineering documents | Effect |
---|---|
offline_asr_sample | CI130X Offline speech recognition project |
4. Burn¶
4.1. Images¶
CI130X applications must have five images: images:asr.bin、dnn.bin、user_code.bin、user_file.bin and voice.bin
-
asr.bin:speech model;
-
dnn.bin:acoustic model;
-
user_code.bin:application program developed by developers, compiled by vscode;
-
user_file.bin: list of command words defined by developers and other bin files of developers;
-
voice.bin:broadcast.
4.2. Images processing tool¶
-
Path: SDK\projects\offline_asr_sample\firmware\
-
Name: composite partition bin file.bat
-
Function: After calling this script_ The asr.bin, dnn.bin, and user are automatically generated under the respective directories of file and voice_ File.bin and voice.bin files.
4.3. Burning mode¶
Use the serial port upgrade tool PACK_ UPDATE_ Tool.exe upgrades the firmware to offline_ asr_ The sample project is burned as an example.
Step 1: Upgrade the hardware connection of the serial port¶
(1) Use TYPE-C to upgrade the hardware connection method:
-
1:TYPE-C data cable, connected to PC
-
2:Short circuit TX0 and RX0
(2) The method of upgrading hardware connection with USB to serial port tool:
-
1:Power supply (5V/GND)
-
2:TX0 and RX0 are connected to RXD and TXD of USB serial port tool
-
3:USB to serial port tool, connecting to PC
Step 2: Compile code to generate user_ code. Bin file¶
(1)For the compilation method, please refer to the document ☞《Installation and Use of Compiled Software》
(2)After compiling, SDK projects offline_ asr_ sample\firmware\user_ Application code generated by code user_ code. Bin, as shown in Figure 4-5 below:
Step 3: Generate 4 other bin files required¶
Method 1: Direct synthesis in compiling software
(1)Run (synthetic partition bin file. bat) as shown in the following steps:
(2)The synthetic running results of the compiled software terminal are as follows:
Method 2: Double click to run the script (composite partition bin file. bat
(1)Enter SDK projects offline_ asr_ Sample firstware , as shown in Figure 4-6 below::
(2)Double click to open the composite partition bin file Bat, the running interface is as shown in Figure 4-7. Wait until the software is running and automatically exit. After calling the script, the SDK projects offline_ asr_ sample\firmware\asr、dnn、user_ The asr.bin, dnn.bin, and user are automatically generated under the respective directories of file and voice_ File.bin and voice.bin files.
!!! note: * After 10s processing, cmd.exe automatically exits. If it does not automatically exit, the. bin file generation fails. Please check asr, dnn, and user_ Whether the file or file name under file and voice is correct.
Step 4: Package five bin files into a bin file¶
Method 1: Start the package upgrade tool PACK in the vscode compilation environment, as shown in the following figure_ UPDATE_ TOOL.exe
Method 2: Enter SDK projects offline_ asr_ Under sample firstware , as shown in Figure 4-6, double-click to open (package upgrade. bat) and open PACK_ UPDATE_ TOOL.exe
Method 3: Enter SDK tools and open PACK_ UPDATE_ TOOL.exe, the interface is shown in Figure 4-9 below:
When the software is opened for the first time, a prompt box will pop up, and the interface is shown in Figure 4-10 below. CI130X needs to be selected here.
- CI130X: It is currently the CI130X usage mode
- English: It is currently displayed in Chinese and can be switched to English by clicking
- Firmware packaging: switch to the firmware packaging interface
- Firmware upgrade: switch to the firmware upgrade interface
- Press “F1” to view Help: more instructions on using the upgrade tool
Click the (Firmware Packaging) button on the main interface of the serial port upgrade tool, and the interface is shown in Figure 4-12 below:
Confirm whether the reserved size of five partitions is appropriate, such as user_ code. The actual size of bin is 0x262A3 bytes, but the reserved size is 0x23000 bytes. At this time, the reserved size of the user zone needs to be adjusted to 0x27000 bytes, and other partitions can be reduced accordingly. voice. The actual size of bin is 0XD80B9 bytes, and the reserved size of voice is 0x25,000 bytes. At this time, the reserved size of voice is reset to 0XD9000 bytes, which can reduce other partitions accordingly.
Note
- The reserved size is configured as an integer multiple of 0x1000.
Click the (Package Firmware) button, and the window that the firmware has been generated will appear, indicating that the firmware is completed.
Click OK, and then click SDK projects offline_ asr_ Generate a. bin file in the sample firmware directory The bin file name consists of the package interface software name and software version. Firmware as shown in Figure 4-13 below_ V200.bin:
Step 5: Upgrade the firmware¶
After completing the above steps. The following confirmation is recommended:
-
Ensure that the hardware connection is correct (see step 1 for details);
-
Make sure that the TYPE-C cable or USB serial port tool is connected to the PC, and the PC can recognize the COM port;
-
Ensure that the firmware is generated correctly;
-
Make sure the microphone and speaker are correctly connected to the development board.
Click the firmware upgrade button on the interface as shown in Figure 4-10 or Figure 4-11, and the interface is shown in Figure 4-14 below:
-
1: Select the firmware generated in step 4 or the firmware provided by our company
-
2: Select the correct COM port
-
3: Reset the development board (either by the reset button or by powering off and restarting), and the development board will automatically start upgrading. After the upgrade is completed, update successful is displayed
For more firmware creation information, you can visit ☞《Command Words and Firmware Production Guide》page, or press “F1” from the start page of Figure 4-10 to view the help.
Step 6: Verify the firmware¶
After burning, restart the development board, offline_ asr_ After the sample project is started, there will be voice broadcast. After the broadcast, say the wake-up word “Smart Housekeeper”, and then broadcast “Hello”, indicating that the upgrade was successful.
***If there is no voice broadcast, please refer to the following (Chapter 5 - Commissioning) to find out the specific reason**
5. Commissioning¶
There is a way to debug an application:
- Use the log mechanism to track code execution and data.
5.1. Log Mechanism¶
Log is printed through the serial port to track the execution of the application.
5.1.1. Log Output Pin Configuration¶
UART0_ The TX pin is the output pin of the default Log UART (you can also reconfigure other pins for the log function). If other serial ports are configured as log output, configure macro CONFIG_ CI_ LOG_ UART. Modify or add user as shown in Figure 5-1 below_ Macro definition in config. h:
It is recommended that the user in the project directory_ Configure in config. h, do not modify the sdk directly_ default_ Macro definitions in config. h.
5.1.2. Log Serial Port Tool Configuration¶
The PC uses the serial port tool to configure as follows. The SDK default serial port 0 print baud rate is 921600:
Note
Since the data output from the serial port is in Chinese, it is recommended to use a serial port tool that supports UTF-8 fonts.
The serial port tool SecureCRT is recommended. For more information about SecureCRT, please ask::☞https://www.vandyke.com/products/securecrt/
5.1.3. Log Print Common Interface¶
General log printing interface:
The usage of mprintf (fmt, args…) is the same as that of printf.
5.1.4. Log Print Package Interface¶
To facilitate user debugging, the SDK encapsulates the following interfaces:
Table 5-1 Print API
Debug API | Funtion |
---|---|
ci_logverbose(comlevel, message, args…) | Log printing - detail |
ci_logdebug(comlevel, message, args…) | Log printing – debug |
ci_loginfo(comlevel, message, args…) | Log printing – information |
ci_logwarn(comlevel, message, args…) | Log printing – warning |
ci_logerr(comlevel, message, args…) | Log printing – error |
ci_logassert(comlevel, message, args…) | Log Print - Assertion |
Debug level, which indicates the level of log to be printed. Seven categories are defined:
Table 5-2 Commissioning level
Debug Level | Usage Scenario |
---|---|
#define CI_LOG_VERBOSE | print all |
#define CI_LOG_DEBUG | debug, information, warning, error, assertion |
#define CI_LOG_INFO | Information, warning, error, assertion |
#define CI_LOG_WARN | warning, error, assertion |
#define CI_LOG_ERROR | error, assertion |
#define CI_LOG_ASSERT | assertion |
#define CI_LOG_NONE | do not print |
Note
Use Table 5-1 to encapsulate the interface. CONFIG must be_ CI_ LOG_ EN is defined as 1.
5.1.5. Log Print Length Configuration¶
#define UART_LOG_BUFF_SIZE 512
The default print length is 512 bytes, and macro UART can be configured_ LOG_ BUFF_ SIZE Changes the print length.