Accessing I2C Registers

Hello everybody!
I have been trying to access the I2C2 registers which are connected to
the expansion header. However, it is seems that I am missing
something.
I have configured the expansion header to enable i2c2_scl and
i2c2_sda.
I have set the bit[16] of registers 0x48004A00 and 0x48004A10 to 1.
They are respectively the I2C2 functional and interface clocks.
However, when I try to set the I2C2 registers, the values are kept
unchanged. I have tried a soft reset as well but it still did not
work.
Does anyone have any suggestion or could tell me a tutorial in the
internet?
Thanks a lot!
Frederico

The omap3 linux kernel i2c driver exports a userland interface.

There are some notes here for an omap3 gumstix, but you can do the
translation to beagleboard.
The gumstix expose i2c-3 on their expansion header instead of i2c-2.

http://www.jumpnowtek.com/index.php?option=com_content&view=article&id=69:gumstix-i2c&catid=35:gumstix&Itemid=67

I think you went trough pin muxing first. I don’t have an xp board but I think this might be necessary to expose the interface, just check it out.
Fabio

You can use the /dev/i2c-2 user-space interface as it.. On the
BeagleBoard there is no need to mess around with the pin-muxing if you
use a standard linux kernel.

I work with the interface each day, and it worked out of the box with
the Angstroem 2.6.27 and 2.6.34 kernels and the Android 2.6.27 and
2.6.34 kernels (e.g. Android FroYo and Android Eclair).

Works well with the Rev C4 and RevB4 boards.

Cheers,
    Nils Pipenbrinck

hi Freddy,
  I explain here how to access i2c-2 from userland.
http://elinux.org/index.php?title=BeagleBoard_Trainer_Nunchuk

Don Lewis
--- -----

First, I would like to thank you all for trying to help me solve this
problem!

Fabio, I know what you mean but that can't be the problem. As Nils
mentioned, the I2C2 uses MUX 0 which is standard. I have also checked
the registers 0x480021BC and 0x480021C0, the values are correct.

Don, I have gone through your explanation but it didn't really help
me. I don't have this Nunchuk and would it necessary to install the
beagleboard_trainer_chuck.tgz? I didn't get it.

Scott, the website which you sent me, seems to be really helpful. I
will definitely use the code in the examples at the bottom of the page
as a reference to write my program.

However, I still can not understand why can't I set the I2C2 registers
direct from my console.
Thanks once again!
Frederico

I have been trying to use the i2cTool which was in Don's link,
however, without success until now.

Using the "cat" command like bellow, I receive the same error for the
three i2cs.

root@beagleboard:/dev# cat i2c-2
cat: i2c-2: Remote I/O error

However, I can't say exactty what the problem could be.
On the other hand, a timeout which the board was giving me, and I
obtain the following:

root@beagleboard:/home/freddy# dmesg | grep i2c
[ 20.921173] i2c_omap i2c_omap.1: bus 1 rev3.12 at 2600 kHz
[ 20.935791] i2c_omap i2c_omap.2: bus 2 rev3.12 at 400 kHz
[ 20.946228] i2c_omap i2c_omap.3: bus 3 rev3.12 at 100 kHz
[ 22.576660] input: twl4030_pwrbutton as /devices/platform/i2c_omap.
1/i2c-1/1-0049/twl4030_pwrbutton/input/input1
[ 22.587890] i2c /dev entries driver

I am able to read the i2c2 registers but I still can't write anything
on them.

Maybe this information can help a little more.
Thanks,
Frederico

You may need to force the writing.
The code below is a program I used to config audio manually.
May it help you.

Hi, for the sake of testing i2c-2 in user space, any of the newer
images supporting
the TinCanTools Trainer board should be ready to use the i2c tools.

Don Lewis
--- -----