cancel
Showing results for 
Search instead for 
Did you mean: 

How Do I read an LIS3MDL X/Y/Z registers in single conversion mode?

DBash.1
Associate

I am attempting to use single conversion mode to read x/y/z data.

My configuration is:

- CTRL_REG1: set data rate to 5Hz/ x/y Axis ultra high perf mode

- CTRL_REG2: set full scale to 16 gauss

- CTRL_REG3: Single-conversion mode

- CTRL_REG4: Z-Axis mode - Ultra-high-performance mode

- CTRL_REG5: BDU set to 1

Once config registers are written as described above I use a loop:

{

read status register until it returns ZYXDA (0x08).

read x/y/z registers

// device automatically returns to IDLE mode.

Write 0x00 to CTRL_REG3 to set single conversion mode again

}

Once x/y/z registers are read the 1st time ZYXDA status bit never gets set to 1 again.

Does this logic look correct?

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @DBash.1​ ,

>> Write 0x00 to CTRL_REG3 to set single conversion mode again

To set the single mode you should Write 0x01 to CTRL_REG3, isn't it?

I suggest you also to have a look to the examples on Github for a general check of your code (lis3mdl_read_data_polling.c, lis3mdl_interrupt.c).

-Eleon