ST意法半导体
直播中

王兵

7年用户 203经验值
私信 关注
[问答]

我想使用嵌入式FIFO来最小化处理器负载,但无法找到正确的配置该怎么办?

嗨,我正在开发一个应用程序,使用通过SPI连接的LSM303D来连续记录加速度。我想使用嵌入式FIFO来最小化处理器负载,但无法找到正确的配置。数据表对FIFO操作不是很清楚,例如:未说明最大FIFO深度。

我按如下方式设置了LSM303D:
CTRL0 = 0x60;
CTRL1 = 0x3F;
CTRL2 = 0xD8;
CTRL3 = 0x80;
CTRL4 = 0x01;
CTRL5 = 0x03;
CTRL6 = 0x20;
CTRL7 = 0x02;
FIFO_CTRL = 0x29;

在初始化期间,我停止加速和磁力计功能,如上所述设置设备,然后仅重新启动加速采样。
我看到的是,当所有测量都停止时,STATUS_A为0x08,即无论我多快读回加速度值,都可以获得新的X,Y,Z数据集。然后,在重新启用加速度计后,STATUS_A变为0xFF但未检测到INT2触发。

是否有正确的FIFO操作的示例代码或过程?我发现LSM303系列的软件库都没有使用FIFO(有些根本不使用中断)。

先谢谢你,
Giannis
#lsm303d

以上来自于谷歌翻译


以下为原文




Hi, I am developing an application using the LSM303D connected via SPI to continuously log the acceleration. I want to use the embedded FIFO to minimise the processor load but cannot find the correct configuration. The datasheet is not very clear about FIFO operation, e.g. the maximum FIFO depth is not stated.

I have set up the LSM303D as follows:
CTRL0 = 0x60;
CTRL1 = 0x3F;
CTRL2 = 0xD8;
CTRL3 = 0x80;
CTRL4 = 0x01;
CTRL5 = 0x03;
CTRL6 = 0x20;
CTRL7 = 0x02;
FIFO_CTRL = 0x29;

During initialisation I stop acceleration and magnetometer functions, set up the device as above and then restart only acceleration sampling.
What I see is that while all measurements are stopped, the STATUS_A is 0x08, i.e. a new X,Y,Z data set is available, no matter how fast I readback the acceleration values. Then, after I re-enable the accelerometer, STATUS_A becomes 0xFF but no INT2 trigger is detected.

Is there an example code or procedure for correct FIFO operation? None of the software libraries for the LSM303 family I have found use  the FIFO (some do not use interrupts at all).

Thank you in advance,
Giannis  
#lsm303d

回帖(1)

刘埃生

2019-6-6 17:55:43
学习一下
举报

更多回帖

发帖
×
20
完善资料,
赚取积分