Skip to main content
Visitor II
August 30, 2022
Question

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

  • August 30, 2022
  • 1 reply
  • 860 views

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?

    This topic has been closed for replies.

    1 reply

    ST Employee
    September 9, 2022

    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