Linux IIO development
 help / color / mirror / Atom feed
From: Andreas Kemnade <andreas@kemnade.info>
To: jean-baptiste.maneyrol@tdk.com, linux-iio@vger.kernel.org,
	hns@goldelico.com, tony@atomide.com
Subject: [BUG] mpu9150 magnetometer not working without powering accelerometer
Date: Fri, 28 Mar 2025 22:56:31 +0100	[thread overview]
Message-ID: <20250328225631.74b82927@akair> (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

                 reply	other threads:[~2025-03-28 22:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250328225631.74b82927@akair \
    --to=andreas@kemnade.info \
    --cc=hns@goldelico.com \
    --cc=jean-baptiste.maneyrol@tdk.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox