Skip to content

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. Protocol Introduction

2.1. Data Package for acquiring CMD ID

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 Tail
  • 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.

获取命令词id功能数据包

2.2. Data Package for using CMD ID to play prompt

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 Tail
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 voice prompts function. The detailed protocol waveform is shown in the following figure.

用命令词id播放本地播报音功能数据包

2.3. Data Package for acquiring Semantic ID

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 Tail
  • 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_4

  • 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.

获取语义id功能数据包

2.4. Data Package for using Semantic ID to play prompt

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 Tail
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_4

  • 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.

用语义id播放本地播报音功能数据包


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, configure MSG_USE_I2C_EN to 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, set debug macro of i2c_protocol_module.h to 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 the corresponding macro of i2c_protocol_module.h to 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 corresponding macro of user_config.h to 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