cancel
Showing results for 
Search instead for 
Did you mean: 

Is LSM303AGR DRDY signal mandatory to use Linux 4.14 ST driver?

SSERR.11
Associate II

Hello,

We are encountering an issue using magnetometer function of a LSM303AGR.

I2C line is OK, we can read WhoAmI register of both accelerometer and magnetometer using low level I2C functions. So we can retrieve accelerometer data without any problem using ST Linux Driver (kernel version 4.14).

Problems appears when this driver try to probe the magnetometer part, failing with this message:

[ 2.832446] iio iio:device1: DRDY on pdata not valid.

[ 2.838107] st-magn-i2c: probe of 3-001e failed with error -22

On our design, DRDY is indeed not connected.

According Linux documentation about device tree, "st,drdy-int-pin" DTS property is optional and driver may work without it (so it's absent in our DTS).

So here's my 2 questions:

  • Can we consult magnetometer without taking care of DRDY signal, and what are the risks?
  • Can we configure driver in order to do not use DRDY signal?

Thanks

Sylvain

5 REPLIES 5
Eleon BORLINI
ST Employee

Hi @SSERR.1​ , but is your issue related to the DRDY signal physically routed on the INT_MAG/DRDY pad (pin7) of the LSM303AGR, or is the interrupt not risen also in the INT_CTRL_REG_M (63h) register (you could poll this interrupt to check this)? Can you check if the INT_MAG_PIN bit of CFG_REG_C_M (62h) register, the bit that drives the interrupt on the physical pin, can be correctly configured? Btw, if the ODR is not so high (and the BDU bit of CFG_REG_C_M (62h) register is active), the risks related to a fake data read a is very very low (almost safe). Regards

SSERR.11
Associate II

Hi @Eleon BORLINI​ ,

My question is mainly related to Linux driver distributed by ST.

I may check if INT_CTRL_REG_M or CFG_REG_C_M show the interrupt correctly, but that's not the point here.

Our goal is to use driver, and as long as driver does not probe at startup I cannot use the magnetometer (at least easely).

Since DRDY signal is optional in documentation, I wonder why missing DRDY signal prevents driver probing.

For example, is there a way to configure driver to pull registers instead of using an interrupt signal?

SSERR.11
Associate II

Additionally, I sent a mail to denis.ciocca@st.com, who wrote the driver according comments. No response so far.

Hi @SSERR.1​ , Dennis is correctly the reference person for linux drivers. Let me try to contact him too and come back to you. Regards

SSERR.11
Associate II

Got a response from Denis this morning, here it is:

---

Yes you are right, it is market as optional in the documentation but it is actually not true anymore. I think some latest patch broke the statement.

Indeed if you check at the source code, the option is optional only with sensors that do not have registers for the interrupts configuration.

I suggest to fill this information in the device tree and try to use a different trigger from the default if you are going to use the trigger/buffer functionality of the iio framework. Setting for example the value to 1 should not impact the behavior of the driver.

---

This responds to my initial question, we will try to modify DTS like he said.