旧乡故客
发表于: 2024-4-23 10:55:21 | 显示全部楼层

最近有客户在使用YBX-BMI088模块时,可以读取到加速度计数据,但是数据有些异常,三轴加速度采集的数据,无法转换到正常Z轴9.8m/s2。陀螺仪及温度数据可正常读取。


BMI088模块支持SPI通讯方式,并且板载LDO电源,支持3.3V和5V电源输入。客户使用GD32F303开发板进行测试,并且根据帖子“NULCEO-G070RB开发板通过SPI方式使用BMI088加速度传感器的方法”中的硬件图进行连接,CSB1连接至PD11,CSB2连接至PB12。连接实物图如下:

4.jpg

单步调试代码,查看读取数据的变量值:

2.jpg

用串口打印输出加速度值:

3.jpg

可以明显看出加速度计的数据跳动比较大,不是有效的数据。


查看计算加速度计数据的公式,代码中:

5.jpg

设置的量程在6G,所以公式是正确的。


最后发现是读取的原始数据有问题,读取加速度计数据时,返回的第一个数据时假数据,第2个数据之后才是真实数据。

在BMI088手册第6.1.2 SPI interface of accelerometer part章节中:

In case of read operations of the accelerometer part, the requested data is not sent immediately, but instead first a dummy byte is sent, and after this dummy byte the actual reqested register content is transmitted.

This means that – in contrast to the description in section 6.1.1 – a single byte read operation requires to read 2 bytes in burst mode, of which the first received byte can be discarded, while the second byte contains the desired data.


返回的数据#2到#7对应0x12-0x17的加速度数据,在代码中进行调整后数据正常。


YBX-BMI088(SPI)加速度传感器模块的淘宝链接:https://item.taobao.com/item.htm?id=591903885679


跳转到指定楼层
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题 4 | 回复: 4



手机版|

GMT+8, 2024-5-4 03:49 , Processed in 0.038548 second(s), 7 queries , Gzip On, MemCache On. Powered by Discuz! X3.5

YiBoard一板网 © 2015-2022 地址:河北省石家庄市长安区高营大街 ( 冀ICP备18020117号 )

快速回复 返回顶部 返回列表