cancel
Showing results for 
Search instead for 
Did you mean: 

How should data ready output be configured for LIS2MDL.

turboscrew
Senior III

I've tried to use LIS2MDL with interrupts without success.

What needs to be done, and does it work with continuous mode?

It looks (by the data sheet) like enabling the DRDY (bit 0 in CFG_REG_C) would be enough, but seems not.

It looks like DRDY is not an interrupt, although also tried setting INT_on_PIN in CFG_REG_C and IEN in INT_CTRL_REG, but no success.

The thing works fine if I read it cyclically using a 100 ms timer.

4 REPLIES 4
Eleon BORLINI
ST Employee

​Hi @turboscrew​ , a couple of questions to better understand the issue. At which ODR are you running? If you are polling the Zyxda data-ready signal bit of STATUS_REG at ODR frequency, do you still see 0 value? And which communication protocol are you using, I2C ore SPI and, in case of SPI, 3-wire or 4-wire? Regards

I'm using 10 HZ, and I'm polling somewhat the same frequency, and I use I2C.

I didn't even poll the data ready bit, but just read the data. To me the values are not important yet, but getting it to work is.

I'm actually using MIKROE-3310 module, which has LIS2MDL on it, but that shouldn't be important here.

https://www.mikroe.com/3d-hall-3-click

Oh, and the line works - it changes state when I write the configuration, but not after that.

Verified with logic analyzer.

​So you are working at 3.3V with correct pull-up resistors. When you are writing "The thing works fine if I read it cyclically using a 100 ms timer.", do you mean you are reading correct values every 100ms -and it's ok because you are running at ODR 10Hz- (but without getting an interrupt on DRDY/INT1 pin)? Basically the Zyxda SW bit is HW routed on the DRDY/INT1 pin and knowing that bit status would exclude routing issue. Regards

turboscrew
Senior III

I figured it out. After setting up I read the data once (in the setup function). After that the DRDY-pin started working. Reading status didn't help.

I happened to notice that when the timer-based polling was used, also DRDY-interrupts were there. With DRDY-interrupt alone, no action.