imx6q porting MPU-6050(gyro sensor) driver question (kernel version is 3.10.53)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx6q porting MPU-6050(gyro sensor) driver question (kernel version is 3.10.53)

2,496 Views
WeiWeiBo
Contributor II

Hi Every One

 

i have a porting question as tittle said...

1. I use the imx6q system board to develop with android version is 4.4.3 , linux kernel is 3.10.53

2. recently i want to porting the MPU6050 driver code into my system board, but meet the driver code is not support linux kernel device tree structure

therefore, try to modified driver code to match new kernel version device tree structure...but after test...i still can not  to launch the MPU6050 sensor function successfully, the log message as below... , therefore, i want to ask whether any driver patch could reference to modified or any other about MPU6050 driver code device tree information... thx

 

attachment file is my driver code so far....

and below is my dts structure and log

 

imx6q.dts (setting the mpu6050 device node)

 

&i2c3 {

 

 

  clock-frequency = <400000>;

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_i2c3_2>;

  status = "okay";

 

  mpu6050@69{

  compatible = "inv, mpu-6050";

  reg = <0x69>;

  interrupt-parent = <&gpio7>;

  interrupts = <13 2>;

  pwr-gpios = <&gpio6 7 0>;   /* active high: */

  int-gpios = <&gpio7 13 0>;   /* active high: */

  };

 

};

 

mach-imx6q.c (in order to turn on the mpu power)

 

 

static void __init imx6q_mpu_init(void){

  pr_warn("!!start mpu Power gpio\n");

  struct device_node *np = NULL;

  int ret, pwr_gpio;

  np = of_find_node_by_name(NULL, "mpu6050");

  if (!np)

  return;

printk("---------------start mpu power gpio-------------\n");

  pwr_gpio = of_get_named_gpio(np, "pwr-gpios", 0);

  if (gpio_is_valid(pwr_gpio)) {

  ret = gpio_request_one(pwr_gpio, GPIOF_OUT_INIT_LOW,

  "mpu Power On");

  pr_warn("!!request mpu Power gpio\n");

  if (ret)

  pr_warn("failed to request mpu Power On gpio\n");

  }

  msleep(5);

  gpio_set_value(pwr_gpio, 1);

  gpio_free(pwr_gpio);

  printk("---------------end mpu power gpio-------------\n");

 

 

}

 

 

 

 

logcat message

W/Resources(  152): Preloaded drawable resource #0x1080626 (android:drawable/tab_selected_focused_holo) that varies with configuration!!

W/Resources(  152): Preloaded drawable resource #0x108062d (android:drawable/tab_unselected_pressed_holo) that varies with configuration!!

W/Resources(  152): Preloaded drawable resource #0x1080628 (android:drawable/tab_selected_pressed_holo) that varies with configuration!!

I/Zygote  (  152): ...preloaded 274 resources in 1090ms.

D/dalvikvm(  152): GC_EXPLICIT freed 35K, 11% free 2714K/3044K, paused 1ms+2ms, total 17ms

I/Zygote  (  152): ...preloaded 31 resources in 25ms.

D/dalvikvm(  152): GC_EXPLICIT freed 15K, 12% free 2708K/3044K, paused 2ms+2ms, total 17ms

D/dalvikvm(  152): GC_EXPLICIT freed 4K, 12% free 2703K/3044K, paused 1ms+2ms, total 17ms

D/dalvikvm(  152): GC_EXPLICIT freed <1K, 12% free 2703K/3044K, paused 1ms+1ms, total 17ms

I/dalvikvm(  152): System server process 446 has been created

I/Zygote  (  152): Accepting command socket connections

I/SystemServer(  446): Entered the Android system server!

D/SensorService(  446): nuSensorService starting...

D/HAL     (  446): load: module = /system/lib/hw/sensors.imx6.so

D/Sensors_mpl(  446): sensors_mpl.cpp enter to open_sensors function1

D/Sensors_mpl(  446): sensors_mpl.cpp enter to open_sensors function2

D/Sensors_mpl(  446): sensors_mpl.cpp enter to open_sensors function3

D/Sensors_mpl(  446): sensors_mpl.cpp enter to open_sensors function4

D/Sensors_mpl(  446): sensors_mpl.cpp enter to open_sensors function5

D/Sensors_mpl(  446): in the sensors_poll_context_t function

D/Sensors_mpl(  446): in the sensors_poll_context_t function new CompassSensor

E/Sensors (  446): SensorBase::SensorBase

V/Sensors (  446): Entering function 'CompassSensor::CompassSensor()'

V/Sensors (  446): Entering function 'int CompassSensor::inv_init_sysfs_attributes()'

E/Sensors (  446): SensorBase::openInput

I/Sensors (  446): path open /dev/input/event3

I/Sensors (  446): path open /dev/input/event2

I/Sensors (  446): path open /dev/input/mice

I/Sensors (  446): path open /dev/input/event1

I/Sensors (  446): path open /dev/input/event0

E/Sensors (  446): filename : event0

E/Sensors (  446): devname : /dev/input/event0

E/Sensors (  446): inputName : INV_AK89XX

E/Sensors (  446): HAL:could not open the compass device node

E/Sensors (  446): HAL:Couldn't read compass mounting matrix

V/Sensors (  446): Entering function 'virtual int CompassSensor::enable(int32_t, int)'

E/Sensors (  446): HAL:open of /sys/class/invensense_compass/ak89xx/enable failed with 'No such file or directory' (2)

D/Sensors_mpl(  446): in the sensors_poll_context_t function new MPLSensor

E/Sensors (  446): SensorBase::SensorBase

D/MPLSensor_MPL(  446): @@@enter to MPLSensor function@@@

D/MPLSensor_MPL(  446): @@@enter to MPLSensor function@@@

D/MPLSensor_MPL(  446): @@@enter to MPLSensor function@@@

V/MPLSensor_MPL(  446): Entering function 'int MPLSensor::inv_init_sysfs_attributes()'

V/MPLSensor_MPL(  446): HAL:Chip ID= MPU6050

E/Sensors (  446): SensorBase::openInput

I/Sensors (  446): path open /dev/input/event3

I/Sensors (  446): path open /dev/input/event2

I/Sensors (  446): path open /dev/input/mice

I/Sensors (  446): path open /dev/input/event1

I/Sensors (  446): path open /dev/input/event0

E/Sensors (  446): filename : event0

E/Sensors (  446): devname : /dev/input/event0

E/Sensors (  446): inputName : MPU6050

D/MPLSensor_MPL(  446): open mpu_int_fd

V/MPLSensor_MPL(  446): HAL:Gyro mpu_int_fd MPU6050 opened : 36

V/MPLSensor_MPL(  446): Entering function 'int MPLSensor::onPower(int)'

V/Sensors (  446): Entering function 'int read_attribute_sensor(int, char*, unsigned int)'

V/Sensors (  446): Entering function 'int enable_sysfs_sensor(int, int)'

V/MPLSensor_MPL(  446): Entering function 'int MPLSensor::masterEnable(int)'

V/Sensors (  446): Entering function 'int enable_sysfs_sensor(int, int)'

E/MPLSensor_MPL(  446): HAL:could not open gyro fifo enable

E/MPLSensor_MPL(  446): HAL:could not open accel enable

V/Sensors (  446): Entering function 'int read_attribute_sensor(int, char*, unsigned int)'

V/Sensors (  446): Entering function 'int read_attribute_sensor(int, char*, unsigned int)'

V/Sensors (  446): Entering function 'int read_attribute_sensor(int, char*, unsigned int)'

I/MPLSensor_MPL(  446): InvenSense MPL 5.0.3

V/MPLSensor_MPL(  446): Entering function 'int MPLSensor::inv_constructor_init()'

V/MPLSensor_MPL(  446): Entering function 'int MPLSensor::inv_constructor_default_enable()'

V/MPLSensor_MPL(  446): HAL:in_use_auto_calibration, disable

V/MPLSensor_MPL(  446): HAL:Invensense vector compass cal enabled

V/MPLSensor_MPL(  446): inv_vector_compass_cal_sensitivity, 3

F/libc    (  446): FORTIFY_SOURCE: vsprintf buffer overflow. Calling abort().

F/libc    (  446): Fatal signal 6 (SIGABRT) at 0x000001be (code=-6), thread 446 (system_server)

I/DEBUG   (  150): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

I/DEBUG   (  150): Build fingerprint: 'MSI/ms57602/ms57602:4.4.3/2.0.0-rc2/20150123:user/dev-keys'

I/DEBUG   (  150): Revision: '0'

I/DEBUG   (  150): pid: 446, tid: 446, name: system_server  >>> system_server <<<

I/DEBUG   (  150): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------

I/DEBUG   (  150): Abort message: 'FORTIFY_SOURCE: vsprintf buffer overflow. Calling abort().'

I/DEBUG   (  150):     r0 00000000  r1 000001be  r2 00000006  r3 00000000

I/DEBUG   (  150):     r4 00000006  r5 0000000d  r6 000001be  r7 0000010c

I/DEBUG   (  150):     r8 2b0ec384  r9 00000004  sl 00000002  fp 7e99008c

I/DEBUG   (  150):     ip 2b0ec384  sp 7e98ff08  lr 2b0b10bd  pc 2b0c0088  cpsr 00070010

I/DEBUG   (  150):     d0  0000000000000000  d1  0000000000000000

I/DEBUG   (  150):     d2  0000000000000000  d3  0000000000000000

I/DEBUG   (  150):     d4  8000000000000000  d5  3fcef049fb9094d1

I/DEBUG   (  150):     d6  0000000100000000  d7  000000003f4ccccd

I/DEBUG   (  150):     d8  0000000000000000  d9  0000000000000000

I/DEBUG   (  150):     d10 0000000000000000  d11 0000000000000000

I/DEBUG   (  150):     d12 0000000000000000  d13 0000000000000000

I/DEBUG   (  150):     d14 0000000000000000  d15 0000000000000000

I/DEBUG   (  150):     d16 3fe99999a0000000  d17 3fc999999999999a

I/DEBUG   (  150):     d18 4146605000000000  d19 0065004e005f0061

I/DEBUG   (  150):     d20 3f8948b0fcd6e9e0  d21 3fe555b0aaeac752

I/DEBUG   (  150):     d22 3fd24998d6307188  d23 3fcc7288e957b53b

I/DEBUG   (  150):     d24 3fc74721cad6b0ed  d25 3fc2f112df3e5244

I/DEBUG   (  150):     d26 40026bb1bbb55516  d27 4000000000000000

I/DEBUG   (  150):     d28 40008df2d49d41f1  d29 3fb0f4a31edab38b

I/DEBUG   (  150):     d30 3ff0000000000000  d31 3f4de16b9c24a98f

I/DEBUG   (  150):     scr 20000010

I/DEBUG   (  150):

I/DEBUG   (  150): backtrace:

I/DEBUG   (  150):     #00  pc 00022088  /system/lib/libc.so (tgkill+12)

I/DEBUG   (  150):     #01  pc 000130b9  /system/lib/libc.so (pthread_kill+48)

I/DEBUG   (  150):     #02  pc 000132cd  /system/lib/libc.so (raise+10)

I/DEBUG   (  150):     #03  pc 00012003  /system/lib/libc.so

I/DEBUG   (  150):     #04  pc 0002193c  /system/lib/libc.so (abort+4)

I/DEBUG   (  150):     #05  pc 00012ae9  /system/lib/libc.so

I/DEBUG   (  150):     #06  pc 00012aff  /system/lib/libc.so

I/DEBUG   (  150):     #07  pc 00023959  /system/lib/libc.so (__vsprintf_chk+24)

I/DEBUG   (  150):     #08  pc 00023975  /system/lib/libc.so (__sprintf_chk+16)

I/DEBUG   (  150):     #09  pc 00005a59  /system/lib/libmllite.so

I/DEBUG   (  150):     #10  pc 00005af3  /system/lib/libmllite.so (inv_get_sysfs_key+6)

I/DEBUG   (  150):     #11  pc 0000b348  /system/lib/libmplmpu.so (inv_check_key+44)

I/DEBUG   (  150):     #12  pc 00009040  /system/lib/libmplmpu.so (inv_start_quaternion+12)

I/DEBUG   (  150):     #13  pc 000052a3  /system/lib/libmllite.so (inv_execute_mpl_start_notification+18)

I/DEBUG   (  150):     #14  pc 00004ceb  /system/lib/libmllite.so (inv_start_mpl+2)

I/DEBUG   (  150):     #15  pc 00004cb3  /system/lib/hw/sensors.imx6.so (MPLSensor::inv_constructor_init()+62)

I/DEBUG   (  150):     #16  pc 00006f37  /system/lib/hw/sensors.imx6.so (MPLSensor::MPLSensor(CompassSensor*)+950)

I/DEBUG   (  150):     #17  pc 00003e75  /system/lib/hw/sensors.imx6.so (sensors_poll_context_t::sensors_poll_context_t()+76)

I/DEBUG   (  150):     #18  pc 00003fcb  /system/lib/hw/sensors.imx6.so

I/DEBUG   (  150):     #19  pc 00007c07  /system/lib/libsensorservice.so

I/DEBUG   (  150):     #20  pc 000070ed  /system/lib/libsensorservice.so

I/DEBUG   (  150):     #21  pc 000094cb  /system/lib/libsensorservice.so

I/DEBUG   (  150):     #22  pc 0000d129  /system/lib/libutils.so (android::RefBase::incStrong(void const*) const+38)

I/DEBUG   (  150):     #23  pc 0000bbdf  /system/lib/libandroid_servers.so

Original Attachment has been moved to: inv_gyro.c.zip

Labels (5)
0 Kudos
1 Reply

954 Views
jamesbone
NXP TechSupport
NXP TechSupport

Hello Victor,

You can get a Linux driver from Invensense they distribute a lot of drivers for different platforms and Linux Kernels, I recommend you to contact them

Here is a link;

Login | Developers

Or you can use the I2CTools to get the device conected and then you can find the device under /dev/i2c


Have a great day,
Jaime

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos