I2C2 communication issue between BB and PIC

Hi!
I’m stuck with my I2C2 issue, so I was wandering maybe you could help me?

I’m in process of building an autonomous robot with camera and BeagleBoard on it. I had a large numbers of problems with getting camera to work on my BB, but I finally managed to do that. Now, the last problem (at least I hope so) is to enable I2C2 communication between BB and PIC microcontroller that is responsible for DC motor control. So, this is what I have done so far on my BB:

  1. Installed custom Angstrom Linux version on my BB .
  2. In menuconfig, I have enabled I2C communication.
  3. In arch/arm/mach-omap2/board-omap3beagle.c I have inserted the following line: “omap_register_i2c_bus(2, 100, NULL, 0)”
    just beneath the:
    “omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom));”
    Those changes are now contained in new uImage file…
  4. In board/ti/beagle/beagle.h I have changed I2C2 MUX settings. They now look like this:
    “MUX_VAL(CP(I2C2_SCL), (IEN | PTU | EN | M0)) /I2C2_SCL/\”
    “MUX_VAL(CP(I2C2_SDA), (IEN | PTU | EN | M0)) /I2C2_SDA/\”
    Those changes are now contained in new u-boot.img file…
  5. Before booting new kernel on my BB, I added this I2C part to my boot arguments:
    “botargs=console=ttyO2,115200n8 root=/devtargs console=ttyO2,115200n8 i2c_bus=2,100 root=/dev/mmcblk0p2 rw rootdelay=1\”
  6. On BB expansion board I have put special circuit, TXS0101-1, that is a level shifter with internal pull-ups so that I can enable communication between 5V PIC and 1.8V BB SDA and SCL lines. I have checked my connections and that should not be the problem (or at least I hope that I’m not so clumsy)
  7. When I boot my kernel (version 3.5.0) and type: “dmesg | grep i2c” I get:
    [ 0.347747] omap_i2c omap_i2c.1: bus 1 rev1.3.12 at 2600 kHz
    [ 0.397155] omap_i2c omap_i2c.3: bus 3 rev1.3.12 at 100 kHz
    [ 0.399169] omap_i2c omap_i2c.2: bus 2 rev1.3.12 at 100 kHz
    [ 4.146209] input: twl4030_pwrbutton as /devices/platform/omap_i2c.1/i2c-1/1-0049/twl4030_pwrbutton/input/input0
    [ 4.161560] i2c /dev entries driver
  8. In /dev section I can see my i2c2 driver:
    i2c-2 ram8 tty52
  9. When I run my custom program for I2C communication (Okay, it’s not mine, a friend of mine but it works 100%) I get this error:
    “[ 484.906494] omap_i2c omap_i2c.2: controller timed out
    Unable to send data: Connection timed out
    Unable to get register! ”

Okay, that is because I didn’t turned on my PIC (which is separately supplied). After powering on, I get the following error:
“Unable to send data: Remote I/O error
Unable to get register! ”

Using oscilloscope I could see that my SDA and SCL pins are always on 1.8V. They are never pulled down!!

So, do you guys perhaps can give me some guidelines?

Thanks!

Hi,

I am using BB with thmod i2c sensor for temperature without any special modification on BB.
I use sparkfun level shifter with pull-ups, see picture

BR,
klemen

Dne torek, 25. september 2012 17:21:28 UTC+2 je oseba Krcevina napisala:

IMG_20120609_134303.jpg

Your BB means Beaglebone
and
His BB means Beagleboard

2012/9/26 Zhivko <klemenzivkovic@gmail.com>

Yeah, but thanks Zhivko anyway :slight_smile:

Is there anyone who can help with at least some suggestion? Pretty desperate here…

Thank You Mr. Daniel very much for trying to help me!

I’ll see to try to do what You have just suggested me, and hopefully I’ll come back with some good news.

Cheers,
Vojislav

Hello,

I’ve been checking the code again and I have to say that it’s OK, I missreaded a define in uboot file:
gedit git/u-boot/arch/arm/include/asm/arch-omap3/omap3.h

I apologize, sorry. :frowning:

It’s okay, I appreciate very much Your help.

I come to conclusion, that the only thing that can cause malfunctioning is this program for I2C communication. Does anyone perhaps have some code that can share so that I can test my BB and it’s i2c communication?

Thanks,
Vojislav

Yeah, as I assumed, the problem was bad program. I managed to connect BB to internet and install i2ctools on it. And when I tested it, I could see everything quite clear on my oscilloscope. So it works!

Just a quick question… Is there any way that I can see code for this i2ctools program, so that I can use it for my own purpose?
Thanks!