ICM-20948 bias read / write

By sylareau , 24 July 2020

I am developing an application based on the ICM20948_eMD_nucleo_1.0, on a nrf52832 board.

The application is working fine but I have an issue. In order to accelerate the automatic calibration of the compass, you have to wave the board in a figure 8 motion for at least 30 sec. From what I understand, if I read the compass biais after calibration and reload them at each start, I won't have to do the whole calibration process.

I have tried that function :
err_code = inv_device_get_sensor_bias(device, INV_SENSOR_TYPE_MAGNETOMETER, magbias);
sprintf(ESBstring, "MAGbias, %.4f, %.4f, %.4f", magbias[0], magbias[1], magbias[2]);
follow by print or send function.

but only get zero value.

This code taken directly from exemple.c in the eMD_nucleo_1.0 exemple also only print the vector values but not the biais - I only get zero's.

case INV_SENSOR_TYPE_UNCAL_MAGNETOMETER:

INV_MSG(INV_MSG_LEVEL_INFO, "data event %s (nT): %d %d %d %d %d %d", inv_sensor_str(event->sensor),
(int)(event->data.mag.vect[0]*1000),
(int)(event->data.mag.vect[1]*1000),
(int)(event->data.mag.vect[2]*1000),
(int)(event->data.mag.bias[0]*1000),
(int)(event->data.mag.bias[1]*1000),
(int)(event->data.mag.bias[2]*1000))

Any suggestion would be greatly appreciate.

randalermanfoc…

5 years ago

Hi sylareau,

Did you ever find an answer to this question? I am seeing the same zero result behavior coming back from the DMP after calibration.

phpbb Post ID
38868

pbalkhisfuca

5 years ago

Hi I've got the same issue, any help?

phpbb Post ID
38885

randalermanfoc…

5 years ago

So, I pieced together at least something

If you run the device in 9 axis mode for a certain amount of time while moving the device around the DMP will auto calibrate. At this point you can read the bias from the mag.

Another thing I finv_dc_float_to_sfix32igured out is that these "float" values that are being set in the DMP need to be converted to s32
inv_dc_float_to_sfix32

phpbb Post ID
38898

attilaschulczt…

4 years 12 months ago

I have some results with

inv_device_icm20948_get_sensor_config(device, INV_SENSOR_TYPE_MAGNETOMETER,INV_DEVICE_ICM20948_CONFIG_OFFSET,accoffi, 3);

But it's only contains any other value than 0 when its calibrated by the DMP.
Have you tried to write back the values at startup? Does it calibrate the sensor?

phpbb Post ID
38915
phpbb Topic ID
38549