cancel
Showing results for 
Search instead for 
Did you mean: 

The magnetic sensor of STEVAL-MKI173V does not enter the data ready state by I2C communication.

KTaky.1
Associate II

Wrote 0x40 to the CTRL1_A register, wrote 0x8C to the CFG_REG_A_M register.

I was able to read the data on the accelerometer via I2C communication, but the magnetic sensor cannot read it.

How do I change the "Zyxda" bit in the magnetic sensor's STATUS_REG_M to 1?

Please tell me.

Upon examination, I found that the "Zyxda" bit of the magnetic sensor's STATUS_REG_M did not become 1.

There was no error in the I2C communication itself.

In addition, I2C communication was performed according to the communication format of LSM303AH.

7 REPLIES 7
Eleon BORLINI
ST Employee

Hi @KTaky.1​ , 

Are you able to correctly raed the magnetometer WHO_AM_I_M (4Fh) register? You should get 40h value.

You said that you wrote 0x8C to the CFG_REG_A_M register... probably there is some issue in this configuration... The magnetometer startup procedure suggested in the AN5087 application note at p. 18 is the following one (ODR=10Hz)

1. Write CFG_REG_A_M = 80h // Temperature compensation enabled // ODR = 10 Hz // Continuous and High-Resolution modes
 
2. Write CFG_REG_C_M = 01h // Configure INT_MAG/DRDY pin as digital output and route data-ready signal

Writing 81h in CFG_REG_A_M instead of 80h will set the magnetometer to operate in Single mode instead of Continuous mode. Can you please try with this?

You can also check the C examples on Github, especially the lsm303ah_read_data_polling.c code. In addition to the CFG_REG_A_M register, here also the BDU bit of CFG_REG_C_M (62h) register and the Set / Reset magnetic sensor mode are configured. 

Let me know if this can be useful for fixing your issue.

-Eleon

KTaky.1
Associate II

Hi Eleon BORLINI,

Thank you for your reply.

I set the CFG_REG_A_M register to single mode.

I also set the BDU bit of the CFG_REG_C_M register and the setting / reset mode of the magnetic sensor.

But the problem doesn't seem to be solved.

So I will investigate if there is any problem with I2C communication.

Thank you for telling me various things.

KTaky.1
Associate II

Thank you for your reply.

I was thinking of implementing this IC for product development,

It turned out that the availability of parts was poor.

I'm sorry while you are investigating the cause, but I'm thinking of investigating another IC myself.

Thank you for telling me.

Eleon BORLINI
ST Employee

Hi @KTaky.1​ ,

actually our LSM303AH is working with the above configuration... Are you receiving the ACK from the magnetometer, right?

And what if you read back the CFG_REG_A_M register content after having configured it?

About the availability of this device at distribution level, yes, I confirm you that there is a risk of supply shortage in the short-mid term.

-Eleon

KTaky.1
Associate II

Hi ,Eleon BORLINI

There is an ACK.

Reading the CFG_REG_A_M register after configuration will bring all electrical signals in the data portion of the magnetic sensor to LOW.

And the value is 0.

Hi @KTaky.1​ ,

did you had the possibility to investigating another IC by yourself?

And did you set the CS of the LSM303AH to Vdd for I2C operation?

-Eleon

KTaky.1
Associate II

Hi Eleon BORLINI ,

CS of LSM303AH is set to VDD.

I'm sorry for your support, but I would like to check other ICs myself.