LSM303d Interrups

Hi i wanted to set up the interrupts using the INT_2 data ready on accelerometer but the whenever i try to read the status of the interrupt it shows ox00.i did enable the INT2_DRDY_A .are there any other registers i need to configure ?

Hello, dpanicker.

INT2_DRDY_A controls whether the data ready signal is sent to the INT2 output pin. If you are only interested in seeing whether data is ready by checking a register, you can read some of the bits in the STATUS_A register (like ZYXADA). Does that help with what you are trying to do?

- Kevin

Thanks Kevin

No ,I want to Generate the interrupt and check whether its been generated or not. i enabled the INT2_DRDY_A in CTRL4.
Actually the problem is i have 3 consecutive readings coming from the accelerometer but i need only one reading .i need to design a pedometer and dont need some many readings.how can i do that ?.so i need an interrupt to tell my STM32F4 that the data is ready and can be fetched from accelerometer.

X-AXIS : -1062 Y-AXIS : -1028 Z-AXIS : 16625
Second is 25
X-AXIS : -1062 Y-AXIS : -1028 Z-AXIS : 16625
Second is 25
X-AXIS : -1203 Y-AXIS : -1380 Z-AXIS : 16408
Second is 25
X-AXIS : -1203 Y-AXIS : -1380 Z-AXIS : 16408
Second is 25
X-AXIS : -1203 Y-AXIS : -1380 Z-AXIS : 16408
Second is 25
X-AXIS : -1400 Y-AXIS : -1548 Z-AXIS : 16585
Second is 25
X-AXIS : -1400 Y-AXIS : -1548 Z-AXIS : 16585
Second is 25
X-AXIS : -1400 Y-AXIS : -1548 Z-AXIS : 16585
Second is 25
X-AXIS : -1656 Y-AXIS : -1196 Z-AXIS : 16815
Second is 25
X-AXIS : -1718 Y-AXIS : -1196 Z-AXIS : 16815
Second is 25
X-AXIS : -1718 Y-AXIS : -1196 Z-AXIS : 16815
Second is 25
X-AXIS : -1718 Y-AXIS : -1196 Z-AXIS : 16815

If you have enabled INT2_DRDY_A, then you should get a data ready indication on the INT2 pin. Do you? How are you trying to measure or read that pin?

I’m not sure I understand the problem you are describing. You will only get data from the accelerometer when you request it, so getting too many readings should not be a problem (you can request data only when you want it); why do you need an interrupt?

- Kevin

I tried reading the status register and it says xyz overrun. how can i stop the overrun .i tried using the oscilloscope but the signal remains high.

I`m designing a pedometer but need proper readings to plot a graph.these values that im currently getting are of no use .so i planned on using an interrupt(data ready) to be generated which the mcu detects and then it reads the values.However as you pointed out the same can be achieved by reading the status register but the problem is its showing overrun how can i stop that and make it to give me ZYXADA.

According to the datasheet, an overrun just means that a reading has been updated before you had a chance to read the previous value, and I don’t really expect that to be a problem unless the acceleration you are trying to detect is changing very quickly (many times a second) or is very brief (a small fraction of a second). Is that the case?

If you do care about detecting a particular brief acceleration, you might consider trying to use some of the other interrupt modes provided by the chip (for example, you could set it to generate an interrupt when the acceleration on a certain axis exceeds a threshold).

Otherwise, it sounds like you’ll just have to make sure you’re trying to read values at the same rate that the accelerometer is providing them (or faster) in order to avoid missing any readings. You might be able to choose a lower acceleration data rate with AODR in CTRL1.

- Kevin