fxos8700 driver probe error on IMX8MP board

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

fxos8700 driver probe error on IMX8MP board

Jump to solution
1,598 Views
WEI_LIU
Contributor I

I connected an FXOS8700CQR1 chip to the I2C bus of IMX8MP, but there was an error when the kernel loaded the driver。

The error message is as follows:

[ 2.326218] fxos8700 3-001e: read chip ID 0x1 is not equal to 0xc7 or 0xc4
[ 2.333122] fxos8700: probe of 3-001e failed with error -22

My devicetree setup like this:

&i2c4{
    clock-frequency = <100000>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_i2c4>;
    status = "okay";
 
    fxos8700@1e {
        compatible = "fsl,fxos8700";
        reg = <0x1e>;
        interrupt-open-drain;
    };
};
 
I have configured the driver in the kernel:
Device Drivers --->
    Misc devices --->
        <*> Freescale FXOS8700 M+G combo sensor
 
The driver located at: kernel/drivers/misc/fxos8700.c
My kernel version is:5.4.70_2.3.0
0 Kudos
Reply
1 Solution
1,564 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @WEI_LIU,

I hope you are doing well.

userspace application is not available.

However, One can use the ioctl call or poll input channels in the userspace application to read sensor data.
Please refer to below links :

http://trac.gateworks.com/wiki/accelerometer

https://wiki.openmoko.org/wiki/Accelerometer_data_retrieval

sysfs entries for the fxos8700 driver are also available. 

Thanks & Regards,
Dhruvit Vasavada

View solution in original post

0 Kudos
Reply
4 Replies
1,584 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @WEI_LIU,

I hope you are doing well.

This error seems to be due to not properly reading Chip ID or incorrect Chip ID in fxos8700_probe().

Please share the schematic of the fxos8700 connection & pinctrl node (dts) for further debugging.

Could you please try to read CHIP ID using the i2c tools utility?

// i2cget -f -y <i2c_bus> <device_address> <device_register>
# i2cget -f -y 3 0x1e 0x0d

Thanks & Regards,
Dhruvit Vasavada

0 Kudos
Reply
1,577 Views
WEI_LIU
Contributor I

The result read by the  i2c tools is: 0xc7

0.png

 

And this is my hardware design:

1.png2.png

 

 

 

 

 

 

 

 

 

 

 

 

 

fxos8700 connected to the i2c4 node of the IMX8MP,  no other pin connections.

And this is my dts configuration:

&i2c4{
    clock-frequency = <100000>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_i2c4>;
    status = "okay";
 
    fxos8700@1e {
        compatible = "fsl,fxos8700";
        reg = <0x1e>;
        interrupt-open-drain;
    };
};
 
pinctrl_i2c4: i2c4grp {
    fsl,pins = <
        MX8MP_IOMUXC_I2C4_SCL__I2C4_SCL 0x400001c3
        MX8MP_IOMUXC_I2C4_SDA__I2C4_SDA 0x400001c3
    >;
};
0 Kudos
Reply
1,570 Views
WEI_LIU
Contributor I

I compiled the driver as a module rather than into the kernel, and then loaded the driver manually, it seems works.

insmod fxos8700.ko
input: fxos8700 as /devices/platform/soc@0/30800000.bus/30a50000.i2c/i2c-3/3-001e/input/input1
fxos8700 device driver probe successfully

 

So, Is there a sample program to read data from the fxos8700 devide?

Thanks!

0 Kudos
Reply
1,565 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @WEI_LIU,

I hope you are doing well.

userspace application is not available.

However, One can use the ioctl call or poll input channels in the userspace application to read sensor data.
Please refer to below links :

http://trac.gateworks.com/wiki/accelerometer

https://wiki.openmoko.org/wiki/Accelerometer_data_retrieval

sysfs entries for the fxos8700 driver are also available. 

Thanks & Regards,
Dhruvit Vasavada

0 Kudos
Reply