2021-04-18 08:50 PM
Composed 0x40 to the CTRL1_A register, composed 0x8C to the CFG_REG_A_M register.
I had the option to peruse the information on the accelerometer by means of I2C correspondence, however the attractive sensor can't understand it.
How would I change the "Zyxda" bit in the attractive sensor's STATUS_REG_M to 1?
If it's not too much trouble, advise me.
Upon assessment, I tracked down that the "Zyxda" piece of the attractive sensor's STATUS_REG_M didn't get 1.
There was no mistake in the I2C correspondence itself.
Furthermore, I2C correspondence was performed by the correspondence arrangement of LSM303AH.
2021-04-19 06:20 AM
Hi @Community member ,
to check if the I2C is fully operating (assuming the digital pattern is correct and you are receiving the ACK from the slave), did you try to read the WHO_AM_I registers of both accelerometer and magnetometer?
If so, you can check from this C driver on Github (lsm303ah_read_data_polling.c) if you correctly configuring the sensor:
/* Enable Block Data Update */
lsm303ah_xl_block_data_update_set(&dev_ctx_xl, PROPERTY_ENABLE);
lsm303ah_mg_block_data_update_set(&dev_ctx_mg, PROPERTY_ENABLE);
/* Set full scale */
lsm303ah_xl_full_scale_set(&dev_ctx_xl, LSM303AH_XL_2g);
/* Set / Reset magnetic sensor mode */
lsm303ah_mg_set_rst_mode_set(&dev_ctx_mg,
LSM303AH_MG_SENS_OFF_CANC_EVERY_ODR);
/* Enable temperature compensation on mag sensor */
lsm303ah_mg_offset_temp_comp_set(&dev_ctx_mg, PROPERTY_ENABLE);
/* Set Output Data Rate */
lsm303ah_xl_data_rate_set(&dev_ctx_xl, LSM303AH_XL_ODR_100Hz_LP);
lsm303ah_mg_data_rate_set(&dev_ctx_mg, LSM303AH_MG_ODR_10Hz);
/* Set magnetometer in continuous mode */
lsm303ah_mg_operating_mode_set(&dev_ctx_mg,
LSM303AH_MG_CONTINUOUS_MODE);
-Eleon