参考套片X100 Hand命令,CPU可以通过I2C总线读取X100寄存器的方式,获取到X100内部温度值和chipID序列号。
环境准备:
1、硬件上CPU通过I2C连接X100 I2C0,X100 I2C0为slave模式。
2、麒麟或者Ubuntu操作系统环境
3、安装i2c-tools工具
读取演示:
1、读取X100摄氏度温度值
//读取温度摄氏度值
sudo i2ctransfer -f -y 1 w10@0x18 0x00 0x70 0x02 0x10 0x28 0x00 0x00 0x00 0x01 0x82
sudo i2ctransfer -f -y 1 w7@0x18 0x00 0x70 0x02 0x10 0x40 0x01 0x18 r8
0x00 0x00 0x00 0x00 0x0f 0x92 0x0f 0xa2
上面返回数值0x00 0x00 0x00 0x00 0x0f 0x92 0x0f 0xa2,得到TS1 温度值( 摄氏度)=0x0f92,TS0温度值( 摄氏度)=0x0fa2,换算为摄氏度,即39.86℃,40.02℃。
2、读取X100 chipID序列号文章来源:https://www.toymoban.com/news/detail-423117.html
//读取chipID低32-bit
sudo i2ctransfer -f -y 1 w10@0x18 0x00 0x70 0x02 0x10 0x28 0x00 0x00 0x00 0x01 0x01 //低32bit
sudo i2ctransfer -f -y 1 w7@0x18 0x00 0x70 0x02 0x10 0x40 0x01 0x18 r8
0x00 0x00 0x00 0x00 0x4b 0x50 0x41 0x30 //KPA0
//读取chipID
sudo i2ctransfer -f -y 1 w10@0x18 0x00 0x70 0x02 0x10 0x28 0x00 0x00 0x00 0x01 0x02
sudo i2ctransfer -f -y 1 w7@0x18 0x00 0x70 0x02 0x10 0x40 0x01 0x18 r8
0x00 0x00 0x00 0x00 0x34 0x39 0x30 0x31 //4901
//读取chipID
sudo i2ctransfer -f -y 1 w10@0x18 0x00 0x70 0x02 0x10 0x28 0x00 0x00 0x00 0x01 0x03
sudo i2ctransfer -f -y 1 w7@0x18 0x00 0x70 0x02 0x10 0x40 0x01 0x18 r8
0x00 0x00 0x00 0x00 0x33 0x32 0x31 0x39 //3219
//读取chipID 高32-bit
sudo i2ctransfer -f -y 1 w10@0x18 0x00 0x70 0x02 0x10 0x28 0x00 0x00 0x00 0x01 0x04 //高32bit
sudo i2ctransfer -f -y 1 w7@0x18 0x00 0x70 0x02 0x10 0x40 0x01 0x18 r8
0x00 0x00 0x00 0x00 0x30 0x30 0x30 0x30 //0000
上面返回共16字节有效数值0x4b 0x50 0x41 0x30 0x34 0x39 0x30 0x31 0x33 0x32 0x31 0x39 0x30 0x30 0x30 0x30,转换成ASCII字符串,即“KPA0490132190000”。文章来源地址https://www.toymoban.com/news/detail-423117.html
到了这里,关于读取飞腾套片X100内部温度和chipID的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!