cancel
Showing results for 
Search instead for 
Did you mean: 

Stream to FIFO mode and WTM interrupt generation

Marco Pappalardo
Associate II
Posted on October 10, 2017 at 12:36

Hi,

I'm using IIS2DH in my application and I am in the need of reading FIFO values registered after a threshold has been reached. For this reason using Stream-to-FIFO mode seemed perfect. But I tried it and I had some problems and doubts.

What I was trying to do was to use this configuration:

INT2_CFG = 0b00101000; //OR Event enabled, High Z, Y axes enabled

INT2_THS = 0b00011000; //24LSB = 1.488 g

CTRL_REG_1 = 0b01001110, //LP 50 Hz X axis disabled

CTRL_REG_2

 = 0b00001011, //Filter: normal mode HPM = 00, ft = 0.2 Hz, FDS = 1, HPIS = 1

CTRL_REG_3

 = 0b00000010, //OVR on INT1

CTRL_REG_4

 = 0b00100000, //Normal MODE, FS=+-8g

CTRL_REG_5 

= 0b01000010, //FIFO enabled with latch on INT2 pin

CTRL_REG_6 

= 0b00100000, //Int function 2 on INT2 pin

FIFO_CTRL_REG

 = 0b10000000,//Stream mode

The idea was to use the INT function 2 (I guess it is referret to the OR the I set in the INT2_CFG register) to toggle the INT2 pin and switch from to Stream mode to the FIFO mode, then read the FIFO overrun interrupt on the INT1 pin, read all FIFO elements through a multiple byte read command and in the end clear the INT2 pin by reading the INT2_SRC register.

In practice after reading the INT2 pin I can't see any FIFO overrun in the INT1 and I cannot know when to read the FIFO ('cause it's full-filled). I've noticed that after the initialization of accelerometer registers I get an interrupt on INT1 pin and I think it's due to the fact that FIFO overrun it's generated also in Stream mode and in FIFO mode, so when the accelerometer starts in Stream mode it will fire a overrun interrupt when FIFO is full-filled. The problem is I don't want to read any value from the accelerometer since the threshold is reached and the FIFO is filled, because this will cause my microcontroller a waste of clock operations and keeps busy the I2C bus.

I also made I try activating another threshold using:

INT1_CFG = 0b00101010; //OR Event enabled, High axes event enabled

INT1_THS = 0b00001100; //12LSB = 192 mg

and enabling AOI1 on CTRL_REG_3, but I've seen that no interrupt is fired on INT1 pin after the INT2 event toggles the INT2 pin.

So my doubts are:

1) Do the latch set on INT2 function locks the entire accelerometer and not only the INT2 pin/function?

2) I also tried to unset the latch on int2 function but what I had is that the FIFO mode where never toggled. Is It because INT2 pin needs to stay at logic level 1 to make the toggle, not just a spike?

3) There is a configuration which I can set to use the accelerometer the way I need?

Thanks,

Marco

#iis2dh
10 REPLIES 10
Posted on October 23, 2017 at 11:02

Yes, I have completely the same register settings.

It is strange it doesn't work in your case. Maybe you can try to share with me your project or the part related to the sensor, so I can have a look at it.