修改Linux内核(Android版)的MPU3050驱动程序使用MPU6050 [英] Modify the MPU3050 driver in linux kernel (Android) to use MPU6050

查看:2310
本文介绍了修改Linux内核(Android版)的MPU3050驱动程序使用MPU6050的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要与Android系统上运行(gsensor,MPU6050)的设备。
我不能直接建造它,因为它不与3.4内核的存在,但我不知道是否可以修改MPU3050的驱动程序为我的设备的作品。

I have a device to run (gsensor, MPU6050) with an Android system. I can't build it directly because it does not exist with the 3.4 kernel, but I wonder if I can modify the MPU3050 driver for my device works.

我发现这个<一个href=\"http://kernel--tegra.android-source-browsing.google$c$c.com/git-history/08f02f8bba6ec3613a3ca3d19e1a07f67739bdd4/drivers/staging/iio/imu/inv_mpu/README\"相对=nofollow>自述,但我不知道它是否会奏效?

I have found this readme, but I wonder if it will work ?

编辑:工作*一半后,的dmesg这里的一部分

<7>[   13.283019] i2c-core: driver [mpu3050] registered
<6>[   13.283119] init: command 'insmod' r=0    
<4>[   13.312403] industrialio: module is from the staging directory, the quality is unknown, you have been warned.
<6>[   13.315656] init: command 'insmod' r=0
<4>[   13.320725] kfifo_buf: module is from the staging directory, the quality is unknown, you have been warned.
<6>[   13.321687] init: command 'insmod' r=0
<4>[   13.329837] ring_sw: module is from the staging directory, the quality is unknown, you have been warned.
<6>[   13.330847] init: command 'insmod' r=0
<6>[   13.354793] hub 4-0:1.0: [hub_activate 872]
<4>[   13.392922] inv_mpu_iio: module is from the staging directory, the quality is unknown, you have been warned.
<7>[   13.395860] i2c-core: driver [inv-mpu-iio] registered

i2ctools检测这样的:

i2ctools detect this:

# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- UU -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU UU UU UU UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU UU UU UU UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
# i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU UU UU UU UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
# i2cdump -f -y 2 0x68
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 89 75 81 e1 1e 0f fb 1e fe 8d 00 a8 28 51 50 b9    ?u????????.?(QP?
10: 86 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ?...............
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00    ...........@....
70: 00 00 00 00 00 68 00 00 00 00 00 00 00 00 00 00    .....h..........
80: 89 75 81 e1 1e 0f fb 1e fe 8d 00 a8 28 51 50 b9    ?u????????.?(QP?
90: 86 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ?...............
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
e0: 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00    ...........@....
f0: 00 00 00 00 00 68 00 00 00 00 00 00 00 00 00 00    .....h..........
# i2cget -f -y 2 0x68
0x75
# i2cget -f -y 2 0x68
0xe1
# i2cget -f -y 2 0x68
0x0f
# i2cget -f -y 2 0x68
0x1e
# i2cget -f -y 2 0x68
0x8d
#

*只要司机已经被编译,内核没有被修改。下面的<一个href=\"http://stackoverflow.com/questions/30253104/writing-a-driver-i2c-for-mpc6050/30259536#30259536\">here.

推荐答案

是的,可以。

请咨询能力和每个设备的寄存器之间的差异的数据表,但我相信你会发现,MPU-6050是如此延伸出的驱动一个MPU-3050的超集,以适应其他应一个简单的例子程序逐的例子。

Consult the data sheets for the difference between the capabilities and registers of each device, but I believe you will find that the mpu-6050 is a superset of the mpu-3050 so extending a driver for one to accommodate the other should be a simple case of programming-by-example.

您的问题是边缘不合适在这里 - #1的存在是为了提供援助的的具体问题的和你有没有表示任何实际的问题超出知道是否有可能,这是上面给出的答案是肯定的,前提是你做的工作,并从可用的资源学会给你。

Your question as asked is borderline inappropriate here - Stackoverflow exists to provide assistance with specific problems and you have not stated any actual issue beyond wondering if it possible, to which the answer as given above is yes, provided that you do the work and learn from the resources available to you.

这篇关于修改Linux内核(Android版)的MPU3050驱动程序使用MPU6050的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆