自己先说说已知的,
首先是指令:
// Bootloader Serial Interface Subsystem
#define SB_RPC_SYS_BOOT 0x4D
// Commands to Bootloader
#define SB_WRITE_CMD 0x01
#define SB_READ_CMD 0x02
#define SB_ENABLE_CMD 0x03
#define SB_HANDSHAKE_CMD 0x04
我通过串口工具检测整个流程,知道了个大概:
PC发送指令:FE 00 4D 10 5D //10是什么鬼?
然后发送:FE 00 4D 04 49 //04对应SB_HANDSHAKE_CMD
ZB回复:FE 01 4D 84 00 C8
然后就开始发包了:FE 42 4D 01 00 00 02 2A 55 02 21 DA FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 02 27 1B FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 4B
此时ZB会回复:FE 01 4D 81 00 CD //81是写入?00是成功?
…………………………//一直发一直回
PC发送:FE 42 4D 01 F0 E9 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 17
ZB回复:FE 01 4D 81 00 CD
一共E9F+1=3744包
发完之后,还要再确定一遍:
PC发:FE 02 4D 02 00 00 4D //SB_READ_CMD
ZB回:FE 43 4D 82 00 00 00 02 2A 55 02 21 DA FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 02 27 1B FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF C9 //该指令数据域内除首字节是00外与一开始PC发的数据一致,00是读取成功?
………………//一直问,一直回
PC发:FE 02 4D 02 F0 E9 54
ZB回:FE 43 4D 82 00 F0 E9 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 95
完成后,PC再发:FE 00 4D 03 4E //03对应SB_ENABLE_CMD,,程序生效?