ST意法半导体
直播中

徐远瑶

8年用户 180经验值
私信 关注
[问答]

LSM6DS3连续FIFO中断如何使用连续模式来读取更多样本

LSM6DS3连续FIFO中断
对于此讨论,1个样本= 6个字节的3d加速度计数据。

我想使用FIFO来节省CPU的电量。
只要所有样本数据都适合FIFO,所有数据都是直截了当的。
我无法弄清楚如何使用连续模式来读取更多样本
而不是适合FIFO。
例:
我想要读取2048个样本x 6个字节。
因为FIFO是8k,我打算读取2 x 1024个样本。我尝试过很多种组合
fifo状态位,但没有方法可行。这是一次尝试:设置

----- FIFO_CTRL3.DEC_FIFO_XL = 1

CTRL4.DRDY_MASK = 1
FIFO_CTRL1 / 2.FTH = 3093 //(1024个样本+7个丢弃(我的设置))* 3
INT1_CTRL.INT1_FTH = 1
FIFO_CTRL5.FIFO_MODE = 6 //连续模式

--- if(FIFO_STATUS2.FIFO_FULL == 0)

//首先阅读
//丢弃初始样本
//首先阅读1024个样本
// next watermark = 1024 - (MAX_FIFO - 已读取)。我通常在第一轮获得1031个样本,
//所以1024 - (4095/3 - (1031)= 1024 - (1365 - 1031)= 1024 - 334 = 690. 690 * 3 = 2070
FIFO_CTRL1 / 2.FTH = 2070
INT1_CTRL.INT1_FTH = 0
INT1_CTRL.INT1_FULL_FLAG = 1 //再次调用isr时,此状态位永远不会被设置
CTRL4.STOP_ON_FTH = 1 //应设置完整位但不设置。仅设置FTH位。
TAP_CFG.LIR = 1 //没有区别
其他
//上次读了
//读取结束1024个样本并关闭XL
// 注意! 'else'代码永远不会执行,因为FIFO_FULL状态永远不会得到setresult

----
第一次中断
FIFO_STATUS1 / 2.DIFF_FIFO == 3093 //正确
FIFO_STATUS2.FTH == 1 //正确
FIFO_STATUS2.FIFO_FULL == 0 // correct2nd中断

FIFO_STATUS1 / 2.DIFF_FIFO == 2068 //错误
FIFO_STATUS2.FTH == 1 //正确
FIFO_STATUS2.FIFO_FULL == 0 //错误---

为什么我没有看到预期的FIFO_FULL标志以及我应该改变什么。
请随意提出另一种方法!

以上来自于谷歌翻译


以下为原文




LSM6DS3 Continuous FIFO interrupts
For this discussion 1 sample = 6 bytes of 3d accelerometer data.

I want to use FIFO to save power on CPU.
As long as all sample data fits in the FIFO, all is straight-forward.
I'm unable to figure out how to use Continuous mode to read more samples
than fit in the FIFO.
Example:
I want's to read 2048 samples x 6 bytes.
Because FIFO is 8k I intend to read 2 x 1024 samples. I have tried many combinations
of fifo status bits, but no approach works. Here's one attempt:setup

-----FIFO_CTRL3.DEC_FIFO_XL = 1

CTRL4.DRDY_MASK = 1
FIFO_CTRL1/2.FTH = 3093 // (1024 samples + 7 discards (my setting)) *3
INT1_CTRL.INT1_FTH = 1
FIFO_CTRL5.FIFO_MODE = 6 // Continuous modeisr

---if (FIFO_STATUS2.FIFO_FULL == 0)

   // first read
    // discard initial samples
    // read first 1024 samples
    // next watermark = 1024 - (MAX_FIFO - already read). I usually get 1031 samples in first round,
    // so 1024 - ( 4095/3 - (1031 ) = 1024 - (1365 - 1031) = 1024 - 334 = 690. 690 * 3 = 2070
    FIFO_CTRL1/2.FTH = 2070
    INT1_CTRL.INT1_FTH = 0
    INT1_CTRL.INT1_FULL_FLAG = 1 // This status bit never gets set when isr is called again
    CTRL4.STOP_ON_FTH = 1 // should set full bit but doesn't. Only FTH bit set.
    TAP_CFG.LIR = 1 // makes no difference
else
    // last read.  
    // Read ending 1024 samples and shut down XL
    // note! 'else' code never executes because FIFO_FULL status never gets setresult

----
1st interrupt
FIFO_STATUS1/2.DIFF_FIFO == 3093 // correct
FIFO_STATUS2.FTH == 1 // correct
FIFO_STATUS2.FIFO_FULL == 0 // correct2nd interrupt

FIFO_STATUS1/2.DIFF_FIFO == 2068 // WRONG
FIFO_STATUS2.FTH == 1 // correct
FIFO_STATUS2.FIFO_FULL == 0 // WRONG---

Why am I not seeing expected FIFO_FULL flag and what should I change.
Please feel free to suggest another method altogether!

回帖(1)

符伯峪

2019-2-22 16:19:49
对不起,在我的Feed中发现旧的僵尸未解答的问题

以上来自于谷歌翻译


以下为原文

Sorry, bumping old zombie unanswered questions off my feed
举报

更多回帖

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