Skip to content

Chipintelli - third-generation chip OTA

1. Overview of OTA functions

The CI230X OTA upgrade function is divided into voice upgrade and WIFI upgrade. The upgrade firmware can be obtained from the cloud, or loaded locally through the serial port for OTA upgrade. The voice upgrade function is also applicable to the CI130X chip. The OTA upgrade code can refer to the CI230X SDK: ci230x released by Chipintelli_ wifi_ combo_ sdk_ Release, (If a third-party WIFI chip is used for OTA of the CI130X chip, the following process is for reference):

2. CI230X voice terminal OTA

2.1. Upgrade Interaction Flow Chart

Figure 2-1

2.2 Instructions for Packaging Tools

  • Upgrade agent updater: ci130x_ updater. bin. The upgrade agent has used UART1 of the chip as the upgrade serial port by default. If you need to change to use other serial ports (such as UART0 or UART2) under special circumstances, please contact Chipintelli Technical Support!

  • OTA voice firmware packaging and upgrading tool: use PACK under the tools directory_ UPDATE_ TOOL355_ FOR_ OTA. When packaging the exe tool, please note that after selecting the corresponding chip model, select “FW_V1” as the firmware format option on the right, and then package the firmware, as shown in the following figure:

Figure 2-2

2.3 Description of WIFI core code

  1. CMakeList. Enable voice chip OTA macro CIAS in txt (SDK/project/ci230x wifi sdk combo/) file_ AIOT_ AUDIO_ OTA_ ENABLE and the corresponding macro to use the cloud platform

  2. Perform OTA initialization in the following configuration sequence:

cias_ ota_ callback_ init();                            // init ota callback func
cias_ get_ cloud_ data_ main();                          // start firmware-get task
get_ cias_ ota_ handle()->cias_ ota_ task_ delay_ ms(2);     // delay few milliseconds
get_ cias_ ota_ handle()->cias_ net_ data_ struct_ init();  // Download the data package structure initialization
cias_ ota_ get_ partitions_ info();                      // Get partition table information
cias_ ota_ progress_ task();                            // start firamware-update task

Note: g_ cias_ system_ manage_ param. ota_ start_ Flag=1 is the flag for the ota upgrade task to start. When the upgrade firmware is ready, you need to set the ota_ start_ Flag set to 1

  1. To complete the upgrade process as described above, the WIFI side needs to implement the following three steps:
  • Need to be in cias_ ota_ callback_ The interface to register hook functions in init() is as follows:
typedef struct
{
/*audio upgrade firmware acquisition, parameter description: 1 - save upgrade buf, 2 - offset address from firmware header, 3 - size to be acquired*/
int (*cias_get_audio_image) (unsigned char *, unsigned int, unsigned int);
/*Wifi chip reset*/
void (*cias_wifi_device_reboot) (void);
/*Audio chip reset*/
void (*cias_audio_device_reboot) (void);
/*Upgrade Serial Port Baud Rate Change*/
void (*cias_communication_rate_change) (unsigned long);
/*Upgrade serial port sending*/
int (*cias_ota_communication_send) (char *, int);
/*Upgrade serial port reception*/
int (*cias_ota_communication_recv) (char *, int);
/*Delay (unit: ms)*/
void (*cias_ota_task_delay_ms) (unsigned int);
/*Flash reading
@param offset Starting offset from the beginning of the flash device.
@param length Size of the portion of flash to read.
@param buffer Pointer on data to read.
@return uint8_ t 0 if operation can start successfully.
*/
unsigned char (*cias_ota_flash_read) (unsigned int offset, unsigned int length, unsigned char *buffer);
/*Network communication protocol initialization*/
void (*cias_net_portocol_init) (void);
/*Initialization of downloading data structure on ota network side*/
int (*cias_net_data_struct_init) (void);
/*Report the upgrade status to the cloud for callback*/
uint8_ t (*cias_report_ota_status_to_iot)(uint8_t);
}cias_ ota_ handle_ t;
  • cias_ get_ cloud_ data_ Main Create the cloud firmware package acquisition task and wait for the command to start acquiring the data package.

  • Ci after 2ms delay_ ota_ progress_ Task() creates the ota serial port transmission task and initializes the cloud packet structure cias in the task_ net_ data_ struct_ Init and obtain cloud firmware partition table information cias_ ota_ get_ partitions_ Info, enter update after obtaining success_ ota_ Main() starts to communicate with the audio terminal bootloader to transmit the updater and verify it, and then communicates with the updater to transmit the firmware package to be upgraded.


3. OTA description of CI230X WIFI terminal

3.1 Configuration

CMakeList. Enable wifi chip OTA macro CIAS in txt (SDK/project/ci230x wifi sdk combo/) file_ AIOT_ WIFI_ OTA_ ENABLE and the corresponding macro to use the cloud platform

3.2 Description of core code interface

  1. ota_ port_ Init() initializes the flash operation interface on the wifi side

  2. cias_ wifi_ ota_ callback_ The required callback function is registered in the init() initialization function:

typedef struct
{
/*Get wifi upgrade data from the cloud*/
int (*cias_get_wifi_image_from_cloud)(unsigned char *, unsigned int, unsigned int len);
/*Report the upgrade status to the cloud for callback*/
uint8_ t (*cias_report_ota_status_to_iot)(uint8_t);
}cias_ wifi_ ota_ handle_ t;
  1. cias_ wifi_ ota_ main_ Task() creates a wifi ota main task and waits for the upgrade task to be enabled (after receiving the wifi ota command issued by the platform, set g_cias_system_manage_param. wifi_ota_start_flag to 1 even if it is enabled)

  2. After the upgrade task is enabled, initialize the watchdog wifi_ ota_ watch_ Dog (), delete tasks that do not need to be run and create cias_ wifi_ ota_ get_ cloud_ Data() Cloud firmware package acquisition task, create cias after 2ms delay_ wifi_ ota_ progress_ Task() task