4 Star 17 Fork 8

bean / BabyOS_Protocol

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

BabyOS_Protocol

介绍

使用QTCreate编写的上位机,配合BabyOS的通用协议b_mod_protocol使用。上位机协议格式配置如下:

头部 ID 长度 指令 参数 校验
1Byte 4Bytes 2Bytes 1Byte 0~nBytes 1Byte

上位机的设备ID为 0x1314


测试指令

指令 参数(7Bytes)
0x1 "BabyOS"

设置时间指令

指令 参数(4Bytes)
0x2 UTC

查询新固件信息

(设备==>上位机)

指令 参数(0Bytes)
0x3 无参数

新固件信息

(上位机==>设备)

指令 参数(72Bytes)
0x3 文件大小(4Bytes) CRC32校验值(4Bytes) 固件名(64Bytes)
固件名长度不足64字节时,补0
typedef struct
{
	uint32_t size;
	uint32_t crc32;
	char filename[64];
}fwinfo_t;

请求分包数据指令

(设备==>上位机)

指令 参数(2Bytes)
0x4 分包序号(2Bytes)
分包序号从0开始

回复分包数据指令

(上位机==>设备)

指令 参数(514Bytes)
0x4 分包序号(2Bytes) 数据长度(512Bytes)
剩余长度不足512字节时,补0

上报升级/传输文件结果指令

(设备==>上位机)

指令 参数(1Bytes)
0x5 升级结果(1Bytes)
校验成功:0
校验失败:1
固件名不匹配:2
文件长度不合理:3

确认升级结果指令

(上位机==>设备)

指令 参数(0Bytes)
0x5 无参数

传输文件至FLASH

(上位机==>设备)

指令 参数(72Bytes)
0x6 文件大小(4Bytes) CRC32校验值(4Bytes) 设备号(4Bytes)偏移地址(4Bytes)

固件名长度不足64字节时,补0

typedef struct
{
	uint32_t size;
	uint32_t crc32;
	uint32_t dev_no;
    uint32_t offset;
}file_trans_t;

通过指令4获取文件数据。

MIT License Copyright (c) 2020 bean Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

使用QTCreate编写的上位机,配合BabyOS的通用协议b_protocol使用 展开 收起
C 等 3 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/notrynohigh/BabyOS_Protocol.git
git@gitee.com:notrynohigh/BabyOS_Protocol.git
notrynohigh
BabyOS_Protocol
BabyOS_Protocol
master

搜索帮助