Skip to content

CI130X serial port protocol V2


1. Overview

This document is our standard voice module serial port protocol design specification, which is convenient for rapid code development and review, and maintenance personnel understand the code framework.

1.1. Functions

  • Complete transmission package, including: head and tail, length, check, message type, and message serial number;
  • Support variable length commands for easy expansion;
  • Message type (command, notification, reply);
  • Command message, configurable, reply to ACK. The notification message has no ACK;
  • The message format will be the same as that of the bootloader upgrade, which is distinguished from the bootloader protocol through the header;
  • Add a unified semantic ID of 6 bytes. The tool needs to generate the corresponding header file to facilitate the use of the platform to make firmware. For more semantic ID descriptions, please refer to ☞CI130X Semantic ID Document Description;
  • The default baud rate is 9600. The default serial port uses UART1 (the fastest serial port is 1M);
  • Supported commands: query the protocol version number, query the system version number, set the volume (the volume rating is defined in user_config. h), play the local broadcast, reset the command, obtain UNIQUEID, and the command word is as compatible as possible with the standard board protocol on CI1006.

1.2. Performance

  • The receiving is processed in interrupt mode and the output is processed in polling mode, so the standard board is not suitable for large data transmission;
  • In terms of code implementation, copy is used to reduce unnecessary malloc/free, so this protocol is not suitable for long commands with too much data.

2. Introduction to the Agreement

2.1. Overview of Serial Port Command Format

Note: non single byte data in the protocol, low byte first, high byte last.

串口命令格式

Figure 2-1 Serial Port Command Format

2.2. Command Details

2.2.1. Error reply

Note: Use this reply when sending an error

ACK:

当发送错误时回复

Fig. 2-2 Reply when sending error

2.2.2. Speech recognition results

Note: After entering the wake-up state, the voice module will send the message (including wake-up words) after recognizing the result.

CMD:

识别到结果后发送该消息

Figure 2-3 sends the message after identifying the result

The format of the ACK package is as follows, but the function and retransmission mechanism are not implemented yet.

ACK包格式

Figure 2-4 ACK Package Format

2.2.3. Play local broadcast

Note: It is used to play the broadcast saved in the firmware of the voice module.

CMD:

播放播报音cmd

Figure 2-5 Play CMD

ACK :

串口命令格式

Figure 2-6 Play ACK

2.2.4. Obtain UNIQUEID

Note: It is used to query the unique ID of flash. Note that this function requires the support of flash devices.

CMD:

查询flash的uniqueID-CMD

Figure 2-7 Query the uniqueID CMD of flash

ACK:

查询flash的uniqueID-ACK

Figure 2-8 Query the uniqueID ACK of flash

2.2.5. Get version number

Note: Used to query the SDK version number used by the firmware in the voice module.

CMD:

查询SDK的版本号-CMD

Figure 2-9 Query the SDK version number - CMD

ACK:

查询SDK的版本号-ACK

Figure 2-10 Querying the SDK version number - ACK

2.2.6. Reset module

Description: Used to reset the voice module.

CMD:

串口命令格式

Figure 2-11 Reset Voice Module CMD

ACK:

串口命令格式

Figure 2-12 Reset Voice Module ACK

2.2.7. Setting function

Note: It is used to set some function options of the module and the serial port protocol.

CMD:

设置功能选项-CMD

Figure 2-13 Setting Function Options CMD

ACK:

设置功能选项-ACK

Figure 2-14 Setting Function Options - ACK

2.2.8. Status notification

Note: It is used to send notification of voice module status change.

CMD:

语音模块状态改变的通知-CMD

Figure 2-15 Notification of voice module status change - CMD

2.2.9. Enter OTA mode

Note: It is used to set the voice module to enter the OTA mode.

CMD:

进入OTA模式-CMD

Figure 2-16 Enter OTA mode CMD

ACK:

进入OTA模式-ACK

Figure 2-17 Enter OTA mode - ACK

3. Serial port protocol configuration

Specific configuration of serial communication:

串口通讯的具体配置

Figure 2-18 Specific Configuration of Serial Communication

It is recommended that developers configure the following under their own project path, and do not modify the sdk_ default_ config. H file. The following is sample_ Take the light project as an example to modify the serial port communication configuration. Open SDK projects sample_ light\user_ config.h.

#define MSG_ COM_ USE_ UART_ EN                  1
#define UART_ PROTOCOL_ NUMBER            (HAL_UART1_BASE)
#define UART_ PROTOCOL_ BAUDRATE          (UART_BaudRate9600)

4. Serial port protocol instructions

CI130X serial port protocol V2 has the following characteristics:

  • Complete transmission package, including header and footer, length, verification, message type, and message serial number.
  • Support variable length commands for easy expansion.
  • Message type (command, notification, reply).
  • Command message, configurable, reply to ACK. The notification message has no ACK.
  • The message format will be the same as that of the bootloader upgrade, which is distinguished from the bootloader protocol through the header.
  • The default baud rate is 9600. The default serial port uses UART1 (the fastest serial port is 1M).
  • Supported commands: query the protocol version number, query the system version number, set the volume (the volume rating is defined in user_config. h), play the local broadcast, reset commands, etc. The specific protocol format is shown in the following figure:

Example 1:

  • A5 FC 07 00 A0 91 18 01 55 E0 01 00 00 1B 9B 02 FB is resolved as follows:,

  • A5 FC:head

  • 07 00: Valid data is 7byte
  • A0: This is the command word information
  • 91: The command number is 0x91 (this data content is command word data)
  • 18: Package serial number, the 0x08th outgoing data of this serial port, and the value is continuously accumulated
  • 01 55 E0 01 00 00: unique data of the current command word
  • 1B: Command word threshold
  • 9B 02: Cumulative Sum
  • FB: End data

Example 2:

  • A5 FC 02 00 A3 9A 17 00 B1 05 02 FB is resolved as follows:

  • A5 FC :head

  • 02 00: Valid data 2byte
  • A3: currently notification data
  • 9A: The command number is 0X9A (the data content is the voice module content change this time)
  • 17: The serial port sends data for the 0x07th time, and the value is continuously accumulated
  • 00 B1: Valid data. (This data indicates entering the wake-up state)
  • 05 02: Cumulative Sum
  • FB: End data

Reference figure of serial port protocol data:

串口协议数据参考图

Figure 2-19 Reference Diagram of Serial Port Protocol Data

In practical application, users can easily connect the electronic control board of the device with the CI130X chip (module) by using the serial port protocol. The module delivered by our company can be designated to burn the corresponding serial port protocol firmware. When users develop and upgrade traditional equipment to voice equipment, they can only add the code for the main control chip of the electronic control board to process the serial port protocol, instead of developing the code for the CI130X chip or module end, It reduces the learning time of voice chip development and improves the efficiency of program development.

Taking the clothes pole as an example, when the user connects the serial port of the electric control board with the serial port of the CI130X chip on the circuit, and the CI130X chip with serial port protocol firmware is burned to receive the corresponding voice command, the communication serial port of the CI130X chip will send the protocol data as shown in the following figure. If the user sends out the command word of “打开吹风”, the CI130X chip performs voice recognition. After recognition, it will send out the serial port protocol data as shown in the third line of the figure below. After receiving the data through the serial port, the main control chip of the electric control board of the clothes dryer processes the recognition and finds that it is the protocol sent out by the command word of “打开吹风”, which can control the motor and other equipment to perform the action of opening blowing.

串口协议固件实例

Figure 2-20 Serial Port Protocol Firmware Example

matters needing attention:

  1. Modify UART_ PROTOCOL_ When NUMBER, please confirm whether the serial port has been occupied by other peripherals or codes. The SDK uses UART0 as the log by default (for more logs, please refer to ☞SDK Quick Start Document CI130X_ Quit_ Start document) output port;

  2. Other default parameters of serial communication: data bit: 8 bits, stop bit: 1 bit, no odd and even parity check. The serial port of the main control chip of the electric control board shall also be configured according to this parameter. If you need to modify, please modify UART in the corresponding UART initialization interface (UARTInterruptConfig, UARTPollingConfig, UARTDMAConfig)_ For the calling parameters of the LCRConfig function, refer to ☞General Asynchronous Transceiver Document.