Skip to contentSkip to conversation

mpu9150 magnetometer not working without powering accelerometer

BUG Andreas Kemnade 1 participant 1 message Mar 28, 2025 IIO

lore
Share & tools
lore
#0 lore raw

Hi,

on the Epson Moverio BT-200 containing two MPU 9150 I see a strange behavior where I see only nearly fixed values until I enable the accelerometer or gyroscope shortly. I am a bit puzzled what is really going on here. It is the inv-mpu6050 driver.

Some tries:

root@bt200deb:~# cat /sys/bus/iio/devices/iio\:device1/in_magn_?_raw
27
27
27
root@bt200deb:~# cat /sys/bus/iio/devices/iio\:device1/in_magn_?_raw
26
26
26

x/y/z keep nearly the same and almost equal.

root@bt200deb:~# cat /sys/bus/iio/devices/iio\:device1/in_accel_?_raw
5950
-1782
14156

just one read from the accelerometer and things change for the magnetometer.

root@bt200deb:~# cat /sys/bus/iio/devices/iio\:device1/in_magn_?_raw
54
54
-2
root@bt200deb:~# cat /sys/bus/iio/devices/iio\:device1/in_magn_?_raw
61
57
1

a full power cycle later and operating at register level:

root@bt200deb:~# cat /sys/bus/iio/devices/iio\:device1/in_magn_?_raw
26
28
28
root@bt200deb:~#

force powering on the chip

root@bt200deb:~# echo on >/sys/bus/i2c/devices/1-0068/power/control 
root@bt200deb:~# cat /sys/bus/iio/devices/iio\:device1/in_magn_?_raw
26
28
31
root@bt200deb:~# i2cget -f -y 1 0x68 0x6C    
0x3f
-> PWR_MGMT_2 -> everything in standby

enable accelerometer axes:

root@bt200deb:~# i2cset -f -y 1 0x68 0x6C 0x7

putting accelerometer axes into standby:

root@bt200deb:~# i2cset -f -y 1 0x68 0x6C 0x3f

enable runtime powermangement

root@bt200deb:~# echo auto >/sys/bus/i2c/devices/1-0068/power/control 
root@bt200deb:~# cat /sys/bus/iio/devices/iio\:device1/in_magn_?_raw
57
59
-1

magnetometer working.

Does anyone have some hints what is going on here and what could be the real fix? Same behavior for the other mpu in the device head->scratch(); ...

Of course the accelerometer could be enabled in probe() but that feels more like a hackfix.

Regards,
Andreas