2021-04-01 06:16 PM
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.
2021-04-06 09:24 AM
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
2021-04-12 12:03 AM
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.
2021-04-14 06:30 PM
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.
2021-04-15 03:17 AM
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
2021-04-18 05:05 PM
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.
2021-04-20 03:28 AM
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
2021-04-21 06:00 PM
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.