Skip to main content
Luca Lorusso
Associate
October 23, 2018
Question

Problem with the iis328dq's data ready interrupt

I'm trying to read the data from the iis328dq using the data ready function.

To do so, I wrote the CTRL_REG1 with 27h and CTRL_REG3 with 82h to have the accelerometer working in normal mode with 50 Hz of ODR. I use SPI at 25 Mbit/s to comunicate with the device.

I encountered 2 problems:

1)Initially no interrupts were generated from the accelerometer. Inserting a dummy read of the out registers after the power on of the accelerometer, I saw that the first interrupt was generated. Basically now reading every set of data multiple times the interrupts are generated until the accelerometer is powered down. Any idea why I see this behaviour?

2)Watching the interrupt line with an oscilloscope, I see that these interrupts are not generated at the ODR I set, but they are randomly generated.

This topic has been closed for replies.

4 replies

ST Employee
October 24, 2018

First, the maximum communication speed is 10MHz.

When do you read the data? After Data ready interrupt is triggered?

Luca Lorusso
Associate
October 24, 2018

I didn't see that, I reduced the SPI speed, thanks.

The portion of code dedicated to the accelerometer is in one case of a switch.

Initially my idea was to read after every data ready interrupt so I put my read routine in an if which is executed only when a variable is changed in the callback function of the interrupt.

Now instead as soon I enter the case I do a dummy read and then there is the if activated by the interrupt where I read and save the data in an array. Without the dummy read, which is repeated every time that the switch is evaluated, I see no interrupts generated.

ST Employee
October 26, 2018

I think, you miss some interrupt, that is why you have to do the dummy read.

Luca Lorusso
Associate
October 26, 2018

I should see them with the oscilloscope if that was the case though. Instead if I try to execute the code without the dummy reads I actually don't see any commutation on the interrupt line.