Changing full scale range of accelerometer in MPL

By dan_goehl , 12 October 2011

Hi,

Is it possible to use the embedded MPL with a range other than +- 2g?

I have found that it is set initially here (mpu6050.c):
struct ext_slave_descr mpu6050_descr = {
.range = {2, 0},
}

And the results are scaled here (ml.c):
/* sensitivity adjustment, typically = 2 (for +/- 2 gee) */
#if defined CONFIG_MPU_SENSORS_MPU6050A2 || defined CONFIG_MPU_SENSORS_MPU6050B1
if (ACCEL_ID_MPU6050 == mldl_cfg->slave[EXT_SLAVE_TYPE_ACCEL]->id) {
/* the line below is an optimized version of:
accel_sens = accel_sens / 2 * (16384 / accel_sens_trim) */
inv_obj.accel->sens = inv_obj.accel->sens /
mldl_cfg->mpu_chip_info->accel_sens_trim * 8192;

If I change the 2 in the initial configuration and in the scaling will it work with other ranges or do I also need to add a write to the accel configuration register (0x1C) to change the scale?

Update:
Changing the last argument of the mpu_6050_set_fsr() function in mpu6050_init from 2000 (mg) to 8000 or 16000 takes care of setting the configuration register.
I changed the scaling and the following and it seems to be working:
.endian = EXT_SLAVE_FS16_BIG_ENDIAN,
.range = {16, 0},

phpbb Topic ID
13863