CI130X IIC Protocol¶
1. Overview¶
This document is our standard voice module IIC protocol design specification,
It is convenient for developers to quickly develop code and review, and maintainers to understand the code framework.
1.1. Functions¶
-
Complete transmission package: register address, data, check, data tail;
-
Our voice chip IIC supports standard mode of 100 kbit/s and fast mode of up to 400 kbit/s. The default transmission rate of the protocol: 100 kbit/s;
-
CI130X series chips only have one set of IIC0 bus;
-
The default pin uses PB7, PC0;
-
The IIC bus address of our voice module (the IIC address of our chip as a slave) is 0x64 by default. If you want to modify, please configure the register, 0x64 or the value after the upper read/write bit is 0xC8 (write), 0xC9 (read);
-
You can change the configuration to select a different transmission rate. How to modify related parameters will be introduced later in the document;
-
Supported functions: obtain command word ID (8 bits, only non-0 command word ID is supported by default), play local broadcast with command word ID, obtain semantic ID (32 bits, only non-0 semantic ID is supported by default), and play local broadcast with semantic ID;
-
It is agreed that the voice module of the company is slave, and the user equipment that initiates the request is master.
1.2. Performance¶
The reception is processed in interrupt mode, and the output is processed in interrupt mode.
2. Introduction to the Agreement¶
2.1. Get Command Word ID Function Data Package Definition¶
The following table lists the meaning of each byte except the slave device address.
Data direction | Number of bytes | byte1 | byte2 | byte3 |
---|---|---|---|---|
master send | 1 | Register value | ||
slave reply | 3 | Command word ID information | Checksum | Data Trailer |
-
Register value:0x02
-
Command word ID information: command word ID
-
Checksum: register value+command word id information
-
Data tail: 0x5a
Note
By default, only non-zero command word IDs are supported. When there is no recognition result, the command word ID read is 0x00.
The start condition is initiated by the master, and the voice terminal performs a slave. Get the command word ID function. The detailed protocol waveform is shown in the figure below.
2.2. Use the command word ID to play the local broadcast function data package definition¶
The following table lists the meaning of each byte except the slave device address.
Data direction | Number of bytes | byte1 | byte2 | byte3 | byte4 |
---|---|---|---|---|---|
master send | 4 | Register value | Command word ID information | Checksum | Data Trailer |
slave Response broadcast |
-
Checksum:0x03
-
Command word ID information: obtain the command word ID parsed from the command word ID data package
-
Checksum: register value+command word id information
-
Data tail: 0x5a
The start condition is initiated by the master, and the voice terminal performs a slave. Use the command word id to play the local broadcast function. The detailed protocol waveform is shown in the following figure.
2.3. Get semantic ID function data package definition¶
The following table lists the meaning of each byte except the slave device address.
Data direction | Number of bytes | byte1 | byte2 | byte3 | byte4 | byte5 | byte6 |
---|---|---|---|---|---|---|---|
master send | 1 | Register value | |||||
slave reply | 6 | Semantic ID-1 | Semantic ID-2 | Semantic ID-3 | Semantic ID-4 | Checksum | Data Trailer |
-
Register value: 0x04
-
Semantic ID_ 1: Bit 0 - 7 of semantic ID
-
Semantic ID_ 2: The 8th to 15th digits of semantic ID
-
Semantic ID_ 3: The 16th - 23rd bits of the semantic ID
-
Semantic ID_ 4: Bits 24-31 of semantic ID
-
Checksum: register 0x04+semantic id_ 1+semantic ID_ 2+semantic ID_ 3+semantic ID_ four
-
Data tail: 0x5a
Note
By default, only non-zero semantic IDs are supported. When there is no recognition result, the semantic ID read is 0x00000000.
The start condition is initiated by the master, and the voice terminal performs a slave. Get the semantic ID function. The detailed protocol waveform is shown in the figure below.
2.4. Use semantic ID to play the local broadcast function packet definition¶
The following table lists the meaning of each byte except the slave device address.
Data direction | Number of bytes | byte1 | byte2 | byte3 | byte4 | byte5 | byte6 | byte7 |
---|---|---|---|---|---|---|---|---|
master send | 7 | Register value | Semantic ID_ 1 | Semantic ID_ 2 | Semantic ID_ 3 | Semantic ID_ 4 | Checksum | Data Trailer |
slave response broadcast |
-
Register value: 0x05
-
Semantic ID_ 1: Bit 0 - 7 of semantic ID
-
Semantic ID_ 2: The 8th to 15th digits of semantic ID
-
Semantic ID_ 3: The 16th - 23rd bits of the semantic ID
-
Semantic ID_ 4: Bits 24-31 of semantic ID
-
Checksum: register value 0x05+semantic id_ 1+semantic ID_ 2+semantic ID_ 3+semantic ID_ four
-
Data tail: 0x5a
The start condition is initiated by the master, and the voice terminal performs a slave. Use semantic ID to play the local broadcast function. The detailed protocol waveform is shown in the following figure.
3. Configuration related¶
3.1. Modify Protocol Switch Macro¶
It is recommended that developers configure the following under their own project path, and do not modify the sdk_ default_ Config. h file. Open SDK projects offline_ asr_ sample\src\user_ Config. h, turn MSG_ USE_ I2C_ EN configuration is 1.
#define MSG_ USE_ I2C_ EN 1
/*Use iic pin configuration*/
#define USE_ IIC_ PAD 1
/*Standard mode 100 Kbit/s, fast mode 400 Kbit/s*/
#define I2C_ PROTOCOL_ SPEED (100)
3.2. Modify Function Code Macro¶
- The debug statement is turned off by default. If you want to turn it on, modify i2c_ protocol_ The debug macro of module. h is 1;
/*0: Close printing, 1: Open printing*/
#define IIC_ PROTOCOL_ DEBUG 1
- The default wake-up word command word ID and semantic ID are defined as follows. If you need to modify them, open i2c_ protocol_ module.h;
#define IIC_ WAKEUP_ WORD_ CMDID 0x01/* Wake up word Command word ID: 1 byte*/
#define IIC_ WAKEUP_ WORD_ SECID 0x01e05,501/* Wake up word meaning ID: 4 bytes*/
- By default, only the command word ID protocol function is enabled, and the semantic ID protocol function is disabled. To open the semantic ID protocol function, modify i2c_ protocol_ The corresponding macro of module. h is 1. The two protocols can be used at the same time, and the request can be initiated every 30ms as soon as possible;
/*0: Turn off the command word ID protocol function, 1: Turn on the command word ID protocol function*/
#define IIC_ PROTOCOL_ CMD_ ID 1
/*0: Turn off the semantic ID protocol function, 1: Turn on the semantic ID protocol function*/
#define IIC_ PROTOCOL_ SEC_ ID 0
- The default is to actively broadcast wake-up call, welcome call, exit wake-up call, and other command words. If you want to block the active broadcast, use the protocol data to broadcast passively, and modify the user_ The macro related to config. h is 0. The default protocol is passive broadcast. Only wake-up words and other command words are supported.
//Broadcast sound configuration
#define PLAY_ WELCOME_ EN 1//Welcome speech broadcast=1 Yes=0 No
#define PLAY_ ENTER_ WAKEUP_ EN 0//Wake up speech broadcast=1 Yes=0 No
#define PLAY_ EXIT_ WAKEUP_ EN 1//Exit wake-up broadcast=1 Yes=0 No
#define PLAY_ OTHER_ CMD_ EN 0//Command word broadcast=1 Yes=0 No