1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
你好,
我目前正在使用LSM9DS1并希望通过FIFO读取陀螺仪/加速度计数据。 我在CTRL_REG9中启用了FIFO,并在FIFO_CTRL中设置了FIFO模式。关于FIFO的其他所有内容都默认设置。我通过访问X / Y / Z输出寄存器来读取数据。 (这可能是无关的,但目前我按照数据手册的顺序初始化寄存器。因此我在加速度计寄存器之前设置了陀螺仪。我使用59.5 Hz的ODR初始化陀螺仪,然后用50 Hz的加速度计初始化看起来不合逻辑。但我想在CTRL_REG6_XL中设置加速度计的g标度,并自动设置ODR。) 现在的问题是读数据没有写入FIFO存储器。 (当我检查FIFO_SRC寄存器时,存储器中的样本数保持为0) 发生了两件有趣的事: - 如果我按原样保留所有设置并仅将CTRL_REG9更改为旁路模式,则会收到数据 - 当处于fifo模式时,以随机间隔接收一些数据(大约10个不准确的数字) 你知道如何解决这个问题吗? 如果您需要更多信息,请提前告知我们并提前致谢 萨布丽娜 #lsm9ds1 #fifo 以上来自于谷歌翻译 以下为原文 Hello, I'm currently working with an LSM9DS1 and want to read the gyroscope/accelerometer data via FIFO. I enabled the FIFO in CTRL_REG9 and set FIFO mode in FIFO_CTRL. Everything else regarding the FIFO is set on default. I read the data by accessing the X/Y/Z output registers. (This might be unrelated but at the moment I'm initializing the registers in order of the data sheet. Therefore I set the gyro before the accelerometer registers. I initialize the gyroscope with an ODR of 59.5 Hz and later the accelerometer with 50 Hz which doesn't seem logical. But I want do set the g scale of the accelerometer in CTRL_REG6_XL and by that automatically set the ODR.) The problem now is that the read data is not written in the FIFO storage. (When I check the FIFO_SRC register the number of samples in the storage stays 0) Two interesting things happen: - if I keep all the settings as they are and only change CTRL_REG9 to bypass-mode I receive the data - when in fifo-mode some data (about 10 inaccurate numbers) is received in random intervals Do you have an idea how to solve that problem? If you need any more information please let me know and thanks in advance Sabrina #lsm9ds1 #fifo |
|
相关推荐
4个回答
|
|
这是完整的传感器配置。
// CTRL_REG1_G //陀螺仪输出数据速率(59.5 Hz):010 ----- //陀螺仪满量程选择(500 dps):注意--- 01 ---如果更改此值,请相应更改GYRO_SCALE //陀螺仪带宽选择(默认):------ 00 i2c_data_buff [0] = 0b01001000; i2c_send(LSM9D_ACCEL_GYRO_ADDR,0x10,& i2c_data_buff [0],1); // CTRL_REG2_G // Int选择配置(默认):---- 00-- //输出选择配置(默认):------ 00 i2c_data_buff [0] = 0b00000000; i2c_send(LSM9D_ACCEL_GYRO_ADDR,0x11,& i2c_data_buff [0],1); // CTRL_REG3_G //低功耗模式(禁用):0 ------- //高通滤波器(禁用): - 0 ------ //陀螺仪高通滤波器截止(0,1):---- 0101 i2c_data_buff [0] = 0b00000101; i2c_send(LSM9D_ACCEL_GYRO_ADDR,0x12,& i2c_data_buff [0],1); // ORIENT_CFG_G // Pitch(X)轴角速率符号-0 ----- // Roll(Y)角速率符号--- 0 ---- //偏航(Z)轴角速率符号---- 0 --- //定向用户定位----- 000 i2c_data_buff [0] = 0b00000000; i2c_send(LSM9D_ACCEL_GYRO_ADDR,0x13,& i2c_data_buff [0],1); // CTRL_REG4 //启用陀螺仪输出偏航(Z) - 1 ----- //启用陀螺仪输出滚动(Y)--- 1 ---- //启用陀螺仪输出音高(X)---- 1 --- //锁存中断(默认)------ 0- // 4D pos识别(默认)------- 0 i2c_data_buff [0] = 0b00111000; i2c_send(LSM9D_ACCEL_GYRO_ADDR,0x1E,& i2c_data_buff [0],1); // CTRL_REG5_XL //启用accel xyz --111 --- i2c_data_buff [0] = 0b00111000; i2c_send(LSM9D_ACCEL_GYRO_ADDR,0x1F,& i2c_data_buff [0],1); // CTRL_REG6_XL // ODR 50Hz:010 ----- // + -2g比例:注意--- 00 ---:如果更改此项,则还必须相应更改ACC_SCALE //没有抗锯齿过滤器:------- 0 i2c_data_buff [0] = 0b01000000; i2c_send(LSM9D_ACCEL_GYRO_ADDR,0x20,& i2c_data_buff [0],1); // CTRL_REG7_XL //没有高分辨率:0 ------- //旁路滤波器:-00--0-0 i2c_data_buff [0] = 0b00000000; i2c_send(LSM9D_ACCEL_GYRO_ADDR,0x21,& i2c_data_buff [0],1); // CTRL_REG8 //重启否:0 ------- //块更新:-1 ------ //中断激活级别: - 0 ----- //推拉模式:--- 0 ---- // SPI:---- 0 --- //地址增量有效:----- 1-- //大端:------ 0- //软件复位:------- 0 i2c_data_buff [0] = 0b01000100; i2c_send(LSM9D_ACCEL_GYRO_ADDR,0x22,& i2c_data_buff [0],1); // CTRL_REG9 // DRDY_mask_bit启用---- 1 --- // Fifo memory enable ------ 1- i2c_data_buff [0] = 0b00001010; i2c_send(LSM9D_ACCEL_GYRO_ADDR,0x23,& i2c_data_buff [0],1); // FIFO_CTRL // FIFO启用:001 ----- i2c_data_buff [0] = 0b00100000; i2c_send(LSM9D_ACCEL_GYRO_ADDR,0x2E,& i2c_data_buff [0],1) 以上来自于谷歌翻译 以下为原文 Here is the complete sensor configuration. // CTRL_REG1_G // Gyro output data rate (59.5 Hz): 010----- // Gyro full-scale selection (500 dps): CAUTION ---01--- if you change this value, change GYRO_SCALE accordingly // Gyro bandwidth selection (default): ------00 i2c_data_buff[0] = 0b01001000; i2c_send(LSM9D_ACCEL_GYRO_ADDR, 0x10, &i2c_data_buff[0], 1);// CTRL_REG2_G // Int selection config (default): ----00-- // Out selection config (default): ------00 i2c_data_buff[0] = 0b00000000; i2c_send(LSM9D_ACCEL_GYRO_ADDR, 0x11, &i2c_data_buff[0], 1);// CTRL_REG3_G // Low Power mode (disabled): 0------- // High-Pass filter (disabled): -0------ // Gyro high-pass filter cutoff (0,1): ----0101 i2c_data_buff[0] = 0b00000101; i2c_send(LSM9D_ACCEL_GYRO_ADDR, 0x12, &i2c_data_buff[0], 1);// ORIENT_CFG_G // Pitch (X) axis angular rate sign --0----- // Roll (Y) angular rate sign ---0---- // Yaw (Z) axis angular rate sign ----0--- // Directional user orientation -----000 i2c_data_buff[0] = 0b00000000; i2c_send(LSM9D_ACCEL_GYRO_ADDR, 0x13, &i2c_data_buff[0], 1);// CTRL_REG4 // Enable Gyro output yaw (Z) --1----- // Enable Gyro output roll (Y) ---1---- // Enable Gyro output pitch (X) ----1--- // Latched Interrupt (default) ------0- // 4D pos recognition (default) -------0 i2c_data_buff[0] = 0b00111000; i2c_send(LSM9D_ACCEL_GYRO_ADDR, 0x1E, &i2c_data_buff[0], 1);// CTRL_REG5_XL // Enable accel xyz --111--- i2c_data_buff[0] = 0b00111000; i2c_send(LSM9D_ACCEL_GYRO_ADDR, 0x1F, &i2c_data_buff[0], 1);// CTRL_REG6_XL // ODR 50Hz: 010----- // +-2g scale: CAUTION ---00--- : if you change this, you also have to change ACC_SCALE accordingly // No anti-aliasing filter: -------0 i2c_data_buff[0] = 0b01000000; i2c_send(LSM9D_ACCEL_GYRO_ADDR, 0x20, &i2c_data_buff[0], 1);// CTRL_REG7_XL // No high resolution: 0------- // Bypass filter: -00--0-0 i2c_data_buff[0] = 0b00000000; i2c_send(LSM9D_ACCEL_GYRO_ADDR, 0x21, &i2c_data_buff[0], 1);// CTRL_REG8 // Reboot no: 0------- // Block update: -1------ // Interrupt activation level: --0----- // Push-pull mode: ---0---- // SPI: ----0--- // Address increment active: -----1-- // Big endian: ------0- // Software reset: -------0 i2c_data_buff[0] = 0b01000100; i2c_send(LSM9D_ACCEL_GYRO_ADDR, 0x22, &i2c_data_buff[0], 1);// CTRL_REG9 // DRDY_mask_bit enable ----1--- // Fifo memory enable ------1- i2c_data_buff[0] = 0b00001010; i2c_send(LSM9D_ACCEL_GYRO_ADDR, 0x23, &i2c_data_buff[0], 1);// FIFO_CTRL // FIFO enable: 001----- i2c_data_buff[0] = 0b00100000; i2c_send(LSM9D_ACCEL_GYRO_ADDR, 0x2E, &i2c_data_buff[0], 1) |
|
|
|
您的配置似乎是正确的,我尝试了它,它按预期工作。
你不是在连续阅读数据吗?如果您正在高速读取数据,则可以读取所有数据,并且它们不会存储在FIFO中。 这可以解释为什么要从FIFO_SRC寄存器中读取0个样本。 以上来自于谷歌翻译 以下为原文 You configuration seems to be correct, I tried it and it works as expected. Don't you read the data continuously? If you are reading the data at high speed you are able to read all of them and they won't be stored in FIFO. This would explain why you are reading 0 samples from FIFO_SRC register. |
|
|
|
嗨萨布丽娜,
我遇到了类似的问题,发现以下帖子有助于破译如何使用FIFO缓冲区进行设置和读取。 https://github.com/kriswiner/LSM9DS1/issues/5 问候, 巴蒂尔 以上来自于谷歌翻译 以下为原文 Hi Sabrina, I was having similar trouble and found that the following post helped in deciphering how to setup and read using the FIFO buffer. https://github.com/kriswiner/LSM9DS1/issues/5 Regards, Shane |
|
|
|
你好Miroslav和Shane,
我想在FIFO模式下读取不丢失陀螺仪的数据,因为结果不正确。 在关注链接后(我没有意识到他也配置了LSM9DS1)我添加了一些有用的循环。 由于许多变化,我没有注意到我在主功能中的陀螺仪之前调用了加速度计,这导致了很多麻烦。 感谢您的帮助! 此致,萨布丽娜 以上来自于谷歌翻译 以下为原文 Hi Miroslav and Shane, I wanted to read in FIFO mode to not loose data for the gyroscope as the results would not be as correct. After following the link (I didn't realize he also configured a LSM9DS1) I added some loops which helped a lot. Due to many changes I didn't notice that I call the accelerometer before the gyroscope in the main function which caused a lot of trouble. Thank you for your help! Regards, Sabrina |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2730 浏览 1 评论
3239 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1808 浏览 1 评论
3647 浏览 6 评论
6035 浏览 21 评论
1339浏览 4评论
198浏览 3评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
350浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
442浏览 2评论
STM32处理增量式编码器Z信号如何判断中断是正转的还是反向转的?
273浏览 2评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 05:42 , Processed in 1.273733 second(s), Total 81, Slave 65 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号