AnsweredAssumed Answered

Connect iMX6UL-EVK with magnetic sensor GY-271(HMC5883L) via i2c

Question asked by Dao Van Toan on Sep 4, 2019
Latest reply on Sep 5, 2019 by igorpadykov

Hi NXP,

I have a problem in connect magnetic sensor GY-271 with iMX6UL-EVK.

Firstly, I access menuconfig and turn driver of this sensor on. 

Device Drivers > Industrial I/O support > Magnetometer Sensors > Honeywell HMC5843/5883/5883L 3-Axis Magnetometer (I2C) 

Secondly, I customize device tree imx6ul-14x14-evk.dts in arch/arm/boot/dts by adding these line at the end of file:

&i2c4 {
    status = "okay";
    clock-frequency = <100000>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_i2c2>;
    
    hmc5883l@1e {
        compatible = "honeywell,hmc5883l";
        reg = <0x1e>;
        position = <0>;
    };
};

Thirdly, I connect 4 pins of sensor to iMX6Ul kit with power supply is 3,3V and pin 9(SDA)-10(SCL) of J1704 header. <This step is fine>

Lastly, I check with command:

$ i2cdetect -y 1

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- UU -- -- -- 1e --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

It's not return UU in section 1e. It's mean I configured wrong somewhere.

1. What should I do now ?

2. How can I get data from sensor assume that I configured correctly?

As I know that If a device connect correctly, data will display in: /sys/bus/iio/devices/. That's true ?

 

Thank you so much,

Toan

Outcomes