LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-22-2023, 10:29 AM   #1
Mike Davies
Member
 
Registered: Jul 2004
Distribution: Custom Linux, Buildroot, Busybox, Fedora, Raspberry Pi
Posts: 145

Rep: Reputation: 15
Invensense MPU6050 and device trees


I have an InvenSense MPU-6050 on i2c bus /dev/i2c-3.

The kernel driver does not find it, e.g.

Code:
# cat /var/log/messages | grep 6050
Jan  1 00:00:09 pryfyn kern.info kernel: [    9.757536] inv-mpu6050-i2c 1-0068: mounting matrix not found: using identity...
Jan  1 00:00:09 pryfyn kern.warn kernel: [    9.772087] inv-mpu6050-i2c 1-0068: supply vdd not found, using dummy regulator
Jan  1 00:00:09 pryfyn kern.warn kernel: [    9.785356] inv-mpu6050-i2c 1-0068: supply vddio not found, using dummy regulator
Jan  1 00:00:09 pryfyn kern.warn kernel: [    9.913415] inv-mpu6050-i2c: probe of 1-0068 failed with error -121
# i2cdetect -y 3
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
#
I can only think that it is because it it looking on /dev/i2c-1 instead of /dev/i2c-3.

I am at a loss to understand how to specify that it must look on bus 3. The .dts looks like this, which seems to suggest the only things that can be tweaked are the device address and the interrupt pin.
Code:
// Definitions for MPU6050
/dts-v1/;
/plugin/;

/ {
        compatible = "brcm,bcm2835";

        fragment@0 {
                target = <&i2c1>;
                __overlay__ {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        status = "okay";
                        clock-frequency = <400000>;

                        mpu6050: mpu6050@68 {
                                compatible = "invensense,mpu6050";
                                reg = <0x68>;
                                interrupt-parent = <&gpio>;
                                interrupts = <4 1>;
                        };
                };
        };

        __overrides__ {
                interrupt = <&mpu6050>,"interrupts:0";
                addr = <&mpu6050>,"reg:0";
        };
};
I tried changing i2c1 to i2c3, and whilst it compiled OK, the kernel did not generate any messages or files in /sys.

I guess I should say that i2c3 is a bit banging i2c but and not a real hardware device, and it setup with
Code:
// i2c bus for IMU
dtoverlay=i2c-gpio,bus=3,i2c_gpio_sda=27,i2c_gpio_scl=17
Does anyone know how to do this ? It must be possible, but the bit of code, or parameter to tweak is eluding me.

Thanks for your help.
 
Old 08-25-2023, 12:04 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,451

Rep: Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342
We're a bit short of information here, Mike Davies.

That thing is some sort of motion sensor.
  • You have it in what? It only makes sense in a mobile device. Why isn't there an app to talk to it? Are we on Android? iOS? Lineage? Linux?
  • Is there firmware, and is it loaded?
  • Your errors are pretty serious. Vdd = the Drain voltage, or translated from gobbledygook, the positive supply.
  • Vddio = device output implying a certain configuration. This will be your i2c signal, I'm guessing.
  • Error number 121 = "Remote I/O error"

The thing about /dev/i2c-1 & /dev/i2c-3 I don't think is important. They are hardware addresses and relate to your connection to the i2c bus. If you've a kernel with i2c stuff, it will probably poll the few available addresses. But i2c is not my forte. I was in much noisier environments as a rule.

The obvious thing is to check your connections. A missing Vdd would cause an error on Vddio, so you can ignore that one.

Also, scour the web for a walk through or Howto on connecting that thing. Try for a technical note from the suppliers. Otherwise, ring them.
 
Old 08-26-2023, 10:21 AM   #3
Mike Davies
Member
 
Registered: Jul 2004
Distribution: Custom Linux, Buildroot, Busybox, Fedora, Raspberry Pi
Posts: 145

Original Poster
Rep: Reputation: 15
Thanks for the reply.

To answer your questions ...

> You have it in what? It only makes sense in a mobile device. Why isn't there an app to talk to it? Are we on Android? iOS? Lineage? Linux?

It is running on a mobile robot housing a Raspberry Pi 4 running a Linux kernel 5.10.92. There isn't an app to talk to it - full stop. I have to write one.

> Is there firmware, and is it loaded?

It's device tree stuff part of the industrial I/O system

> Your errors are pretty serious. Vdd = the Drain voltage, or translated from gobbledygook, the positive supply.
Vddio = device output implying a certain configuration.

This is not serious. It is just some ancillary stuff that happens by default with the iio system, because the iio system is trying to do lots of different stuff for different things, and in this particular case the Vdd and Vddio are hardwired and cannot be changed on this device.

> This will be your i2c signal, I'm guessing. Error number 121 = "Remote I/O error"

This error is simply the fact that it is looking on the wrong bus. If I move the hardware to i2c-1 then it works without error.

Anyway, I have now found and fixed the problem. The problem is in i2s-sensor-common.dtsi - fragment28. I needed to set a different target, so it is a software change and not something that can be done with dtparam.

Thanks for the reply.

I will mark the thread solved in case someone else treads this path.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Trees, B-Trees, B+Trees and H-Trees LXer Syndicated Linux News 0 07-15-2013 02:11 PM
mkisofs and preserving directory trees crontab Linux - Software 2 03-27-2009 10:00 AM
LXer: Penguins and Fir Trees LXer Syndicated Linux News 0 12-25-2006 03:03 AM
LXer: CDT C/C++ parsing and its abstract syntax trees LXer Syndicated Linux News 0 10-14-2006 06:33 PM
Nvidia drivers and kernel source trees anticitan Linux - Software 2 03-24-2004 11:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration