2020-01-27 06:53 PM
I'm having trouble getting a heading from the LIS2MDL on our custom PCB. A summary of the issue:
My Questions:
Initialization Procedure:
/* LIS2MDL Initialization: Offset Cancellation Disabled */
mag_reset(); // Reset device, set SPI mode, read WHOAMI
lis2mdl_block_data_update_set(&mag_ctx, PROPERTY_ENABLE);
lis2mdl_power_mode_set(&mag_ctx, LIS2MDL_LOW_POWER);
lis2mdl_offset_temp_comp_set(&mag_ctx, PROPERTY_ENABLE);
lis2mdl_operating_mode_set(&mag_ctx, LIS2MDL_SINGLE_TRIGGER);
/* LIS2MDL Initialization: Offset Cancellation Enabled */
mag_reset(); // Reset device, set SPI mode, read WHOAMI
lis2mdl_block_data_update_set(&mag_ctx, PROPERTY_ENABLE);
lis2mdl_data_rate_set(&mag_ctx, LIS2MDL_ODR_100Hz);
lis2mdl_set_rst_mode_set(&mag_ctx, LIS2MDL_SENS_OFF_CANC_EVERY_ODR);
lis2mdl_offset_temp_comp_set(&mag_ctx, PROPERTY_ENABLE);
lis2mdl_operating_mode_set(&mag_ctx, LIS2MDL_CONTINUOUS_MODE);
Logs:
Data dump for both enabled and disabled offset cancellation are attached
Plots:
2020-03-23 08:10 AM
Hi @DB.7ujak , sorry for the very late feedback to your question, mainly due to lot of accumulated work. I (try to) answer your questions here below:
0. I suggest you a time0 calibration of each device magnetic offset, to start all the tests in the same condition.
I suggest you to check the user manual (link) of the MotionMC magnetometer calibration library in X-CUBE-MEMS1 expansion for STM32Cube if it can be of some help.
Regards