IIC通讯协议分析
基本参数
- 使用标准IIC通讯,数据速率为86Kbit/s
- IIC地址分配 使用了8组IIC,对应12个端口,所以有几组是共用的
地址分组表格
端口 | 分组 | IIC地址 |
---|---|---|
1 | 1 | 0x10 |
2 | 2_3 | 0x10 |
3 | 2_3 | 0x11 |
4 | 4_5 | 0x10 |
5 | 4_5 | 0x11 |
6 | 6 | 0x10 |
7 | 7 | 0x10 |
8 | 8_9 | 0x10 |
9 | 8_9 | 0x11 |
10 | 10_11 | 0x10 |
11 | 10_11 | 0x11 |
12 | 12 | 0x10 |
指令流程
下面是抓取的一段指令数据以及分析:
//设备总线初始化,疑似获取IIC数据速率 86Kb/s
//如果是开关类设备,会没有应答而终止
//顺序扫描所有端口,所以和下一条指令之间有12~120ms大小的延时
write to 0x00 ack data: 0x4E 0xCA 0x03
read to 0x30 ack data: 0x56
//疑似确定IIC地址或版本号?
write to 0x30 ack data: 0x4D 0x20
write to 0x10 ack data: 0x20
read to 0x10 ack data: 0x07 0x01 0x02 0x18
//疑似
write to 0x10 ack data: 0x1F
read to 0x10 ack data: 0x00
//
write to 0x10 ack data: 0x1C
read to 0x10 ack data: 0x01
read to 0x30 nak //疑似确定总线上是否有另一个设备
//疑似获取设备信息
write to 0x10 ack data: 0x28
read to 0x10 ack data: 0x00 0x00 0x00 0x23
//疑似获取设备信息
write to 0x10 ack data: 0x3C
read to 0x10 ack data: 0xFF 0x40 0x6B 0x7F
//疑似获取设备信息
write to 0x10 ack data: 0x40 0x00
write to 0x10 ack data: 0x32
read to 0x10 ack data: 0xFF 0xFF 0xFF
//设备进入待机状态,每120ms发送一次指令
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
//立即发送指令,让马达正转
write to 0x10 ack data: 0x28 0x05
write to 0x10 ack data: 0x3E 0x73 //疑似设置转动参数
write to 0x10 ack data: 0x2A 0x32 //正反转
//待机
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
//发送指令,让马达停止
write to 0x10 ack data: 0x28 0x00
write to 0x10 ack data: 0x2A 0x00
//继续待机
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
log记录
- 第10端口,按键间断触发正转
查看数据...
write to 0x00 ack data: 0x4E 0xCA 0x03
read to 0x30 ack data: 0x56
write to 0x30 ack data: 0x4D 0x20
write to 0x10 ack data: 0x20
read to 0x10 ack data: 0x07 0x01 0x02 0x18
write to 0x10 ack data: 0x1F
read to 0x10 ack data: 0x00
write to 0x10 ack data: 0x1C
read to 0x10 ack data: 0x01
read to 0x30 nak
write to 0x10 ack data: 0x28
read to 0x10 ack data: 0x00 0x00 0x00 0x23
write to 0x10 ack data: 0x3C
read to 0x10 ack data: 0xFF 0x40 0x6B 0x7F
write to 0x10 ack data: 0x40 0x00
write to 0x10 ack data: 0x32
read to 0x10 ack data: 0xFF 0xFF 0xFF
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x05
write to 0x10 ack data: 0x3E 0x73
write to 0x10 ack data: 0x2A 0x32
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x00
write to 0x10 ack data: 0x2A 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x05
write to 0x10 ack data: 0x2A 0x32
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x00
write to 0x10 ack data: 0x2A 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x05
write to 0x10 ack data: 0x2A 0x32
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x00
write to 0x10 ack data: 0x2A 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x05
write to 0x10 ack data: 0x2A 0x32
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x00
write to 0x10 ack data: 0x2A 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x05
write to 0x10 ack data: 0x2A 0x32
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x00
write to 0x10 ack data: 0x2A 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x05
write to 0x10 ack data: 0x2A 0x32
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x00
write to 0x10 ack data: 0x2A 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x05
write to 0x10 ack data: 0x2A 0x32
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x00
write to 0x10 ack data: 0x2A 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
- 第9端口,按键间断触发正转
查看数据...
write to 0x00 ack data: 0x4E 0xCA 0x03 //疑似设备查询波特率
read to 0x30 nak //设备没准备好,所以无应答。准备好会在DIO输出一个100us低电平
read to 0x30 ack data: 0x56 //疑似波特率,表示0x56 = 86Kb/s
write to 0x30 ack data: 0x4D 0x22 //大部分发送0x4D 0x20,之后20ms后发送到新地址0x20
write to 0x11 ack data: 0x20 //20ms后发送到新地址0x20
read to 0x11 ack data: 0x07 0x01 0x02 0x18 //疑似回复确认,和端口无关,应该和设备有关
write to 0x11 ack data: 0x1F
read to 0x11 ack data: 0x00
write to 0x11 ack data: 0x1C
read to 0x11 ack data: 0x01
write to 0x11 ack data: 0x28
read to 0x11 ack data: 0x00 0x00 0x00 0x23
write to 0x11 ack data: 0x3C
read to 0x11 ack data: 0xFF 0x40 0x6B 0x7F
write to 0x11 ack data: 0x40 0x00
write to 0x11 ack data: 0x32
read to 0x11 ack data: 0xFF 0xFF 0xFE
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x28 0x05
write to 0x11 ack data: 0x3E 0x74
write to 0x11 ack data: 0x2A 0x32
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x28 0x00
write to 0x11 ack data: 0x2A 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x28 0x05
write to 0x11 ack data: 0x2A 0x32
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x28 0x00
write to 0x11 ack data: 0x2A 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x28 0x05
write to 0x11 ack data: 0x2A 0x32
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x28 0x00
write to 0x11 ack data: 0x2A 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
- 第4端口,按键间断触发正转
查看数据...
write to 0x00 ack data: 0x4E 0xCA 0x03
read to 0x30 ack data: 0x56
write to 0x30 ack data: 0x4D 0x20
write to 0x10 ack data: 0x20
read to 0x10 ack data: 0x07 0x01 0x02 0x18
write to 0x10 ack data: 0x1F
read to 0x10 ack data: 0x00
write to 0x10 ack data: 0x1C
read to 0x10 ack data: 0x01
read to 0x30 nak
write to 0x10 ack data: 0x28
read to 0x10 ack data: 0x00 0x00 0x00 0x23
write to 0x10 ack data: 0x3C
read to 0x10 ack data: 0xFF 0x40 0x6B 0x7F
write to 0x10 ack data: 0x40 0x00
write to 0x10 ack data: 0x32
read to 0x10 ack data: 0x00 0x00 0x01
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x05
write to 0x10 ack data: 0x3E 0x75
write to 0x10 ack data: 0x2A 0x32
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x00
write to 0x10 ack data: 0x2A 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x05
write to 0x10 ack data: 0x2A 0x32
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x00
write to 0x10 ack data: 0x2A 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x05
write to 0x10 ack data: 0x2A 0x32
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x28 0x00
write to 0x10 ack data: 0x2A 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
write to 0x10 ack data: 0x00
- 第5端口,按键间断触发正转
查看数据...
write to 0x00 ack data: 0x4E 0xCA 0x03
read to 0x30 nak
read to 0x30 ack data: 0x56
write to 0x30 ack data: 0x4D 0x22
write to 0x11 ack data: 0x20
read to 0x11 ack data: 0x07 0x01 0x02 0x18
write to 0x11 ack data: 0x1F
read to 0x11 ack data: 0x00
write to 0x11 ack data: 0x1C
read to 0x11 ack data: 0x01
write to 0x11 ack data: 0x28
read to 0x11 ack data: 0x00 0x00 0x00 0x23
write to 0x11 ack data: 0x3C
read to 0x11 ack data: 0xFF 0x40 0x6B 0x7F
write to 0x11 ack data: 0x40 0x00
write to 0x11 ack data: 0x32
read to 0x11 ack data: 0x00 0x00 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x28 0x05
write to 0x11 ack data: 0x3E 0x75
write to 0x11 ack data: 0x2A 0x32
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x28 0x00
write to 0x11 ack data: 0x2A 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x28 0x05
write to 0x11 ack data: 0x2A 0x32
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x28 0x00
write to 0x11 ack data: 0x2A 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x28 0x05
write to 0x11 ack data: 0x2A 0x32
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x28 0x00
write to 0x11 ack data: 0x2A 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00
write to 0x11 ack data: 0x00