I want to interface bmp085 with beaglebone black at i2c1(pin17 and pin18)
So made following changes
-I made changes in /ksrc/arch/arm/boot/dts/am335x-bone-common.dtsi
i2c0_pins:pinmux_i2c0_pins{
pinctrl-single,pins=<
0x188 0x70 /*i2c0_sda, SLEWCTRL_SLOW | INPUT_PULLUP | MODE0 */
0x18c 0x70 /* i2c0_scl, SLEWCTRL_SLOW | INPUT_PULLUP | MODE0*/
>;
};
/*changed by jaikothari10@gmail.com*/
i2c1_pins:pinmux_i2c1_pins{
pinctrl-single,pins=<
0x158 0x72 /* (PIN_INPUT_PULLUP | MUX_MODE2) */
0x15c 0x72 /* (PIN_INPUT_PULLUP | MUX_MODE2) */
>;
};
/******************************/
i2c2_pins: pinmux_i2c2_pins {
pinctrl-single,pins = <
0x178 0x73 /*uart1_ctsn,i2c2_sda,SLEWSTRL_SLOW | INPUT_PULLUP | MODE3*/
0x17c 0x73 /*uart1_rtsn,i2c2_scl,SLEWCTRL_SLOW | INPUT_PULLUP | MODE3 */
>;
};
Now look at binding document of bmp085 module. (ksrc/Document/devicetree/bindings/misc/bmp085.txt and then make change
/********added by jaikothari10@gmail.com********/
&i2c1 {
pinctrl-names="default";
pinctrl-0= <&i2c1_pins>;
status = "okay"
clock-frequency=<100000>;
pressure@77{ /*client module for i2c */
compatible="bosch,bmp085";
reg=,0x77>;
chip-id=<10>;
temp-measurement-period = <100>;
default-sampling = <2>;
};
Now look at file am33xx.dtsi file (This is master /ksrc/drivers/i2c/buses)
i2c1:i2c@4802a000 {
compatible="ti,omap4-i2c";
#address-cells=<1>;
#size-cell=<0>;
ti,hwmods="i2c2",
reg=<04802a000 0x1000>;
status= "disable";
};
After doing the following steps I compiled the dts file to dtb by dtc (device tree compiler)
$dtc -O dtb -o am335-boneblack.dtb am335x-boneblack.dts
After compile put the dtb file in /boot of BBB rootfs
Then Reboot BBB
Now you will find the /dev/i2c1 entry. Also your bmp085 module would be loaded automatically.
Amazing!!!!!!! Keep smiling :)
For device tree information you can refrer device tree documentation in kernel.More refreances I would add latter.
You can even post comment to this blog if any query?
So made following changes
-I made changes in /ksrc/arch/arm/boot/dts/am335x-bone-common.dtsi
i2c0_pins:pinmux_i2c0_pins{
pinctrl-single,pins=<
0x188 0x70 /*i2c0_sda, SLEWCTRL_SLOW | INPUT_PULLUP | MODE0 */
0x18c 0x70 /* i2c0_scl, SLEWCTRL_SLOW | INPUT_PULLUP | MODE0*/
>;
};
/*changed by jaikothari10@gmail.com*/
i2c1_pins:pinmux_i2c1_pins{
pinctrl-single,pins=<
0x158 0x72 /* (PIN_INPUT_PULLUP | MUX_MODE2) */
0x15c 0x72 /* (PIN_INPUT_PULLUP | MUX_MODE2) */
>;
};
/******************************/
i2c2_pins: pinmux_i2c2_pins {
pinctrl-single,pins = <
0x178 0x73 /*uart1_ctsn,i2c2_sda,SLEWSTRL_SLOW | INPUT_PULLUP | MODE3*/
0x17c 0x73 /*uart1_rtsn,i2c2_scl,SLEWCTRL_SLOW | INPUT_PULLUP | MODE3 */
>;
};
Now look at binding document of bmp085 module. (ksrc/Document/devicetree/bindings/misc/bmp085.txt and then make change
/********added by jaikothari10@gmail.com********/
&i2c1 {
pinctrl-names="default";
pinctrl-0= <&i2c1_pins>;
status = "okay"
clock-frequency=<100000>;
pressure@77{ /*client module for i2c */
compatible="bosch,bmp085";
reg=,0x77>;
chip-id=<10>;
temp-measurement-period = <100>;
default-sampling = <2>;
};
Now look at file am33xx.dtsi file (This is master /ksrc/drivers/i2c/buses)
i2c1:i2c@4802a000 {
compatible="ti,omap4-i2c";
#address-cells=<1>;
#size-cell=<0>;
ti,hwmods="i2c2",
reg=<04802a000 0x1000>;
status= "disable";
};
After doing the following steps I compiled the dts file to dtb by dtc (device tree compiler)
$dtc -O dtb -o am335-boneblack.dtb am335x-boneblack.dts
After compile put the dtb file in /boot of BBB rootfs
Then Reboot BBB
Now you will find the /dev/i2c1 entry. Also your bmp085 module would be loaded automatically.
Amazing!!!!!!! Keep smiling :)
For device tree information you can refrer device tree documentation in kernel.More refreances I would add latter.
You can even post comment to this blog if any query?
No comments:
Post a Comment