0

I am trying to build yocto project on beaglebone black. I would like to enable I2C2 port on beagle bone. I am newbie in yocto project. Any pointer or reference document would be helpful.

here is the original file am335x-boneblack-common.dtsi and I would like to modify that file with following content

    i2c2_pins: pinmux_i2c2_pins {
    pinctrl-single,pins = <0x178 0x73 0x17c 0x73>;
};
user_leds_pins: pinmux_user_leds {
    pinctrl-single,pins = < AM33XX_IOPAD(0x848, PIN_OUTPUT | MUX_MODE7) >; /* P9.14, gpio1[18] */

};

and

leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&user_leds_pins>;
i2c2-live {
    gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>;
    default-state = "on";
};

};

&i2c2: i2c@4819c000 {
pinctrl-names = "default";
pinctrl-0 = <&i2c2_pins>;
status = "okay";
clock-frequency = <100000>;
tmp75@4d {
    compatible = "national,lm75";
    reg = <0x4d>;
};

};

Kindly suggest how to create patch for above code.

Thanks in Advance

Regards, Nikhil

  • Do you mean activate I2C the user space(in /dev/i2cXX) so you can access the bus from userspace ? – Talel BELHADJSALEM Aug 05 '21 at 10:22
  • I would like to access/enable I2C2 port pin for my project. What are the steps to enable it on beaglebone black for yocto project – Nikhil Muley Aug 06 '21 at 08:33
  • You didn't answer the question, how do you want to use the I2C bus? What is your project cast – Talel BELHADJSALEM Aug 06 '21 at 08:35
  • I would like to activate/enable I2C2 in device tree but how to add device tree to yocto project. After adding that I have connect temperature sensor to it. What are the correct steps for adding device tree to yocto project. – Nikhil Muley Aug 07 '21 at 02:47
  • Give me the yocto layer, the I2C bus, the sensor name and its address in the I2C bus and I will help you with a custom Layer that activate all of that for you. – Talel BELHADJSALEM Aug 07 '21 at 09:43
  • BelHadjSalem TALEL, Thanks for your quick response, LM75 is sensor name. https://github.com/beagleboard/devicetree-source/blob/master/arch/arm/boot/dts/am335x-boneblack.dts device tree source. – Nikhil Muley Aug 07 '21 at 11:17

1 Answers1

0

At first you need to understand how to deal with your dts file.

You need to decide whether you want to work with the official dts file that is provided by your linux kernel and patch it. Or, create your own dts file and use it instead.

To understand how to patch the dts or how to add custom one, I have 2 stackoverflow answers for that, here and here.

After you understand that, now lets talk about adding your I2C node.

First, you need to search if your sensor has an official kernel driver.

If it has a driver, then, it has a compatible name that is defined in it.

You take that name with the sensor address in that I2C bus and:

For example, adding the sensor of address 0x01 to I2C 1 bus:

&i2c1 {
    // ...
    sensor_name: sensor_name@0x01 {
         compatible = "compatible_name";
         reg = "0x01";
    }
}

Now, you need to activate the flag of the driver in the kernel defconfig

bitbake linux-XXX -c menuconfig

Activate the flag, and:

bitbake linux-XXX -c diffconfig

it will generate .cfg file containing only the difference.

Take that and add it to your linux recipe:

SRC_URI_append = " file://sensor.cfg"
Talel BELHADJSALEM
  • 3,199
  • 1
  • 10
  • 30