完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我正在尝试使用I2C获取陀螺仪原始数据。 DEN_G连接到MCU的GPIO,我将寄存器设置为使用电平触发模式。我认为I2C从设备地址是正确的,因为当我读到WHO_AM_I_G寄存器时,我得到212这与数据表中的默认数据相同。我确实得到了正确的加速度数据但是当我读取陀螺仪数据时,我移动芯片时数据不会改变。陀螺仪数据只是一个随机变量数字。
所以我检查了CTRL设置寄存器从寄存器地址0x20到0x2D(使用多字节读取)。所有CTRL寄存器都有与我设置的相同的数据。但我发现当我禁用Y,Z轴数据(仅启用X)时,OUT_Y_L,H OUT_Z_L,H仍然有数据。我想我没有读出错误的OUT X,Y,Z寄存器,因为我使用了从0x20到0x2D的多字节读取方法。(0x28~0x2D是OUT_X,Y,Z地址)。 那么有人可以给我一个建议,为什么设置CTRL寄存器不起作用?这是硬件问题吗?或者在读取加速数据后,是否必须清除一些位以获取陀螺仪数据?谢谢 以上来自于谷歌翻译 以下为原文 I am trying to get a gyroscope raw data using I2C. DEN_G is connected to MCU's GPIO and I set the register to use level trigger mode. I think I2C slave address is correct because when I read WHO_AM_I_G register I get 212 which is the same as default data in the datasheet. I do get a correct accel data but when I read the gyro data the data doesn't change when I move the chip. The gyro data is just a random variant number. So I checked CTRL setting register from register address 0x20 to 0x2D(Using multi byte read). All the CTRL registers had a same data as I set them. But I found out that when I disable the Y,Z-axis data(only enabling X) the OUT_Y_L,H OUT_Z_L,H still has a data. I think I am not reading the incorrect OUT X,Y,Z register because I used multi byte read method from 0x20 to 0x2D.(0x28~0x2D are OUT_X,Y,Z address). So can anyone give me an advice why setting CTRL register doesn't work? Is it a hardware problem? or do I have to clear some bits to get a gyro data after I read accel data?Thank you |
|
相关推荐
1个回答
|
|
|
嗨,
我有类似的问题。您可能已经错过了数据表第6.1.1节中的第3段,该段基本上表明您需要设置要从多字节读取开始读取的寄存器地址的最高位。 MSB允许自动增加寄存器地址,而没有多字节读取只是重复读取相同的地址。 希望有一些帮助。 以上来自于谷歌翻译 以下为原文 Hi, I had a similar problem. You may have missed the 3rd paragraph in section 6.1.1 of the datasheet, which basically states that you need to set the most significant bit of the register address you want to start reading from for a multibyte read. The MSB enables autoincrement of the register address, without this a multibyte read just reads the same address repeatedly. Hope thats of some help. |
|
|
|
|
只有小组成员才能发言,加入小组>>
stm32mp157的异核通信的rpmsg_sdb的m4固件和a7驱动该如何编写?
1453 浏览 0 评论
stm32f103用freertos对一个采样率为1kHz的传感器,进行采样,数据出差
1502 浏览 0 评论
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
3649 浏览 1 评论
3842 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
2461 浏览 1 评论
STM32H7打开DCache后,出现了串口接收信息为空的现象,是哪里出了问题?
727浏览 5评论
用NANO STM32F103RBT6的开发板烧录不了是哪里出了问题?
661浏览 5评论
710浏览 5评论
外部中断触发类型为双边沿触发,进入中断回调后有什么办法判断该边沿是上升沿还是下降沿?
941浏览 5评论
STM32L071CBT6低温环境下无法正常工作是什么原因引起的?
745浏览 5评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 04:55 , Processed in 0.729568 second(s), Total 74, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
4203