CI230X - Serial Port Transmission Protocol Between Voice Terminal And WIFI Terminal¶
1. Overview¶
In order to reduce the coupling between the voice end and the WIFI end and increase the stability of the chip, two independent freeRTOS systems are running inside the CI230X chip; The voice end and WIFI end communicate through the serial port, and the communication rate can be set to 9600bits/s~2Mbits/s as required; The CI2306 chip uses the off line scheme. When transmitting audio data to the cloud, the serial communication rate is set to at least 921600bits/s.
The data structure, communication protocol and communication instructions of voice terminal and WIFI terminal communication will be introduced in detail below; If the user uses a third-party WIFI chip to cooperate with the Chipintelli CI130X voice chip, this agreement is also applicable.
2. Transmission of interactive data - data structure:¶
typedef struct
{
unsigned int magic; /* Start data frame. Let's define as 0x5a5aa5a5; */
unsigned short checksum; /* checksum */
unsigned short type; /* Define command type. */
unsigned short len; /* Define data stream len. */
unsigned short version; /* Version information*/
unsigned int fill_ data; /* Fill Data*/
}cias_ standard_ head_ t;
3. Transmission of interactive data - data field analysis:¶
Name | Byte length | Meaning |
---|---|---|
Magic | 4 | Default protocol header, unsigned int type, default “5a5aa5a5” |
Checksum | 2 | Checksum, unsigned short type, default “0000” |
Type | 2 | Type of the current message, unsigned short type |
len | 2 | The data length in the current message (excluding the length of the structure itself, it only represents the data length) |
Version | 2 | version “Version information, default is” 00 “ |
fill_ Data | 4 | Fill in the data. The default “0x12345678” means the following |
If there is other data, it will follow the structure directly, eg memcpy (output+sizeof (cias_data_standard_head_t), (uint8 *) input, len)< Br/>(Note that users should manage the memory of output by themselves) |
#define INVAILD_ SPEAK (0x12345666)
#define RECV_ TTS_ PLAY (0x12345677)
#define RECV_ MP3_ PLAY (0x12345688)
#define RECV_ M4A_ PLAY (0x123456aa)
#define IDLE_ STATUS_ RECV_ M4A_ PLAY (0x123456ab)
#define RECV_ WAV_ PLAY (0x123456bb)
#define DEF_ FILL (0x12345678)
#define WAKEUP_ FILL_ DATA (0x12345678)
#define NO_ WAKEUP_ FILL_ DATA (0x0)
4. Example: The voice terminal transmits a packet of PCM data to the WIFI terminal¶
4.1 Application layer sending:¶
voice_ data_ packet_ and_ send(SEND_PCM_MIDDLE, dst_addr, encode_t);
4.2 Bottom packaging:¶
broadlink_ frame_ create(packet_type, voice_data, packet_len,
(broad_link_buf + buff_count * 1024),1024,0x12345678,0);
4.3 Add to send queue:¶
send_ msg_ to_ network_ task(&send_msg,NULL)
4.4 Serial port sending:¶
network_ send((int8_t *)data->payload,data->length)
5. Serial port interaction instruction between voice terminal and WIFI terminal¶
The serial port communication command of voice end and wifi end is used internally in the system from 0x0101 to 0x0fff. If the user needs to add a command, please add a value outside the range, otherwise there will be a conflict, leading to communication exceptions.
- Voice terminal instruction definition source file
SDK/projects/cias_ aiot_ audio/cias_ msg_ handle/cias_ network_ msg_ protocol.h
- Wifi side instruction definition source file:
SDK/project/ci230x-wifi-sdk-combo/app/cias_ aiot_ wifi/cias_ msg_ handle/cias_ slave_ message_ handle.h
Instruction Type | Instruction Value | Instruction Description |
---|---|---|
Speech recognition command | 0x0101 | Local speech recognition notification |
0x0102 | Wake up | |
0x0103 | Cloud VAD END | |
0x0104 | Skip invalid voice | |
0x0105 | PCM data tundish | |
0x0106 | PCM data end packet | |
0x0107 | PCM data idle | |
0x0108~0x01ff | Reserved | |
Network play command | 0x0201 | Start playing |
0x0202 | Pause playback | |
0x0203 | Resume playback | |
0x0204 | Stop playing | |
0x0205 | Replay | |
0x0206 | Play the next song | |
0x0207 | Play local TTS | |
0x0208 | End of playback | |
0x0209 | Retrieve the playback link | |
0x020a | Get subsequent playback data | |
0x020b | Receive playback data | |
0x020c | Playback data received | |
0x020d | End of playing tts | |
0x020e | Play empty command | |
0x020f~0x02ff | Reserved | |
IOT custom protocol | 0x0301 | Cloud IOT instruction |
0x0302 | Cloud Volume | |
0x0303 | Local volume | |
0x0304 | Increase the volume | |
0x0305 | Decrease the volume | |
0x0306 | Maximum volume | |
0x0307 | Minimum volume | |
0x0308~0x03ff | Reserved | |
Network configuration command | 0x0401 | Enter the distribution network mode |
0x0402 | Distribution in progress | |
0x0403 | Exit the distribution network mode | |
0x0404 | Initial password status | |
0x0405 | Network disconnected | |
0x0406 | Network connection succeeded | |
0x0407 | Authentication file obtained | |
0x0408 | Authentication file needs to be configured | |
0x0409 | Cloud connected | |
0x040a | The cloud is disconnected | |
0x040a~0x04ff | Reserved | |
OTA related instructions | 0x0501 | Start ota |
0x0502 | ota data | |
0x0503 | The ota upgrade is successful | |
0x0504 | Production test | |
0x0505 | Production test succeeded | |
0x0506 | Production test failed | |
0x0507 | Self test | |
0x0508 | Infrared data transmission | |
0x0509 | Infrared code library downloading | |
0x050a | Infrared code library download completed | |
0x050b | Start of infrared download code base | |
0x050c~0x05ff | Reserved | |
0x0601~0x0fff | Reserved |