杰理串口升级规范
📎 原始文档:https://www.kdocs.cn/l/cgjdpFVQFuel 杰理串口升级规范
目录
版本信息.............................................................................................................................3
特征说明.............................................................................................................................4
实现流程.............................................................................................................................4
协议说明.............................................................................................................................6
Develop_doc All information provided in this document is subject to legal disclaimers © JL.V. 2014. All rights reserved.
User manual Rev1.00——29 Apr 2020 2of10
版本信息
| 版本号 | 日期 | 作者 | 备注 |
|---|---|---|---|
| 1.00 | 2020-04-29 | Zhibin | 1.完成初始版本 |
Develop_doc All information provided in this document is subject to legal disclaimers © JL.V. 2014. All rights reserved.
User manual Rev1.00——29 Apr 2020 3of10
特征说明
● 支持标准RX/TX双IO通信
● 支持单IO RX/TX 串口通信
● 支持flash架构为单/双备份升级
● 支持波特率切换命令,提升升级速度
实现流程
1、 固件单备份升级流程图
Develop_doc All information provided in this document is subject to legal disclaimers © JL.V. 2014. All rights reserved.
User manual Rev1.00——29 Apr 2020 4of10
Develop_doc All information provided in this document is subject to legal disclaimers © JL.V. 2014. All rights reserved.
User manual Rev1.00——29 Apr 2020 5of10
2.2 固件双备份升级流程图

协议说明
杰理串口升级规范在“杰理串口控制协议”基础上实现,
(一)、数据包格式
多字节数据:低字节在前,高字节在后,即小端格式(little endian)。
CRC16标准:CRC-CCITT (XModem)
- JL 串口升级命令包格式
| Byte0 | Byte1 | Byte[3 .. 2] | Byte[n-2 ..4] | Byte[n.. n-1] |
|---|---|---|---|---|
| SyncData0 | SyncData1 | Cmd_len | Cmd_data | Crc16 |
参数解释:
SyncData0: 固定为0xAA
Develop_doc All information provided in this document is subject to legal disclaimers © JL.V. 2014. All rights reserved.
User manual Rev1.00——29 Apr 2020 6of10
SyncData0: 固定为0x55
Cmd_len: cmd_data部分的长度
Cmd_data:命令内容
Crc16:整个命令包(除去crc 自身)的crc结果
(二)、升级命令定义
1、 升级开始:0x01( update_start)方向:设备->上位机
| SyncData[2] | Cmd_len[2] | Cmd_data[ 1] | Crc16[2] | |
|---|---|---|---|---|
| 0xAA 0x55 | 0x0001 | Opcode | Para | Crc_res |
| 0x01 | None |
2、 升级开始返回:0x01 ( update_start_res)方向:上位机->设备
| SyncData[2] | Cmd_len[2] | Cmd_data[5] | Crc16[2] | |
|---|---|---|---|---|
| 0xAA 0x55 | 0x0005 | Opcode | Baud[4] | Crc_res |
| 0x01 | 指定波特率 |
命令说明:
Baud[4] :波特率参数为4字节长度。当上位机指定的波特率如果与设备当前波特率不同,设备会用新的波特率再次发起“升级开始”命令。
3、 升级读数据请求:0x02( update_read_req)
方向:设备->上位机
| SyncData[2] | Cmd_len[2] | Cmd_data[9] | Crc16[2] | ||
|---|---|---|---|---|---|
| 0xAA 0x55 | 0x0009 | Opcode | Addr[4] | Len[4] | Crc_res |
| 0x02 | 读地址 | 数据长度 |
命令说明:
Addr[4] :请求升级文件偏移地址 Len[4] :请求升级文件数据长度
4、 升级读数据返回:0x02 ( update_read_res)
Develop_doc All information provided in this document is subject to legal disclaimers © JL.V. 2014. All rights reserved.
User manual Rev1.00——29 Apr 2020 7of10
方向:上位机->设备
| SyncData[2] | Cmd_len[2] | Cmd_data[????] | Crc16[2] | |||
|---|---|---|---|---|---|---|
| 0xAA 0x55 | 0x???? | Opcode | Addr[4] | Len[4] | Data[n] | Crc_res |
| 0x02 | 读地址 | 数据长度 | 数据内容 |
命令说明:
Addr[4] :根据请求命令的地址填充
Len[4] :根据实际读取数据长度填充 Data[n]:填充到升级文件对应偏移地址的数据
5、 升级结束:0x03( update_stop)方向:设备->上位机
| SyncData[2] | Cmd_len[2] | Cmd_data[2] | Crc16[2] | |
|---|---|---|---|---|
| 0xAA 0x55 | 0x0002 | Opcode | Err_code | Crc_res |
| 0x03 | 错误码 |
参数说明:
Err_code[ 1] :错误码对应表如下:
| Err_code | Description |
|---|---|
| 0x0 | 升级成功 |
| 0x1 | 加密key错误 |
| 0x81 | 升级文件大小错误 |
| 0x82 | 升级loader大小错误 |
| 0x83 | Loader校验失败 |
| 0x84 | 读远端文件头失败 |
| 0x85 | 读本地文件头 |
| 0x86 | 找不到目标文件 |
| 0x87 | 文件操作失败 |
| 0x88 | 升级数据校验失败 |
| 0x89 | 产品信息不匹配 |
| Other | 未定义错误 |
Develop_doc All information provided in this document is subject to legal disclaimers © JL.V. 2014. All rights reserved.
User manual Rev1.00——29 Apr 2020 8of10
6、 升级结束返回:0x03 ( update_stop_res)方向:上位机->设备
| SyncData[2] | Cmd_len[2] | Cmd_data[2] | Crc16[2] | |
|---|---|---|---|---|
| 0xAA 0x55 | 0x0002 | Opcode | Err_code | Crc_res |
| 0x03 | 同上 |
7、 升级长度通知:0x04 ( update_len_notify)方向:设备->上位机
| SyncData[2] | Cmd_len[2] | Cmd_data[5] | Crc16[2] | |
|---|---|---|---|---|
| 0xAA 0x55 | 0x0005 | Opcode | Total_len[4] | Crc_res |
| 0x04 | 总升级长度 |
参数说明:
Total_len[4] :
若loader下载阶段是loader下载的总长度;若固件升级阶段是升级内容总长度;
8、 升级长度返回:0x04(update_len_res)方向:上位机->设备
| SyncData[2] | Cmd_len[2] | Cmd_data[ 1] | Crc16[2] | |
|---|---|---|---|---|
| 0xAA 0x55 | 0x0001 | Opcode | Para | Crc_res |
| 0x04 | None |
9、 升级在线通知:0x05(update_alive_notify)方向:设备->上位机
| SyncData[2] | Cmd_len[2] | Cmd_data[ 1] | Crc16[2] | |
|---|---|---|---|---|
| 0xAA 0x55 | 0x0001 | Opcode | para | Crc_res |
| 0x05 | None |
命令说明:
该命令为作为设备在操作flash等需要长时间不发升级命令时候使用,目的为通知上位机设备在线,防止上位机超时。
10、 升级在线返回:0x05(update_alive_res)
Develop_doc All information provided in this document is subject to legal disclaimers © JL.V. 2014. All rights reserved.
User manual Rev1.00——29 Apr 2020 9of10
方向:上位机->设备
| SyncData[2] | Cmd_len[2] | Cmd_data[ 1] | Crc16[2] | |
|---|---|---|---|---|
| 0xAA 0x55 | 0x0001 | Opcode | Para | Crc_res |
| 0x05 | None |
Develop_doc All information provided in this document is subject to legal disclaimers © JL.V. 2014. All rights reserved.
User manual Rev1.00——29 Apr 2020 10of10