This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

I2C0 not working

Other Parts Discussed in Thread: OMAPL138, DA8XX, OMAP-L138

Hi,

I'm trying to access one of the invensense sensors through the I2C0 (I'm working with the OMAPL138 LCDK). I followed the docs and configured my board to set it up using the following code:

static struct mpu_platform_data gyro_platform_data = {
.int_config = 0x00,
.level_shifter = 0,
.orientation = { -1, 0, 0,
0, 1, 0,
0, 0, -1 },
.sec_slave_type = SECONDARY_SLAVE_TYPE_COMPASS,
.sec_slave_id = COMPASS_ID_AK8975,
.secondary_i2c_addr = 0x0E
};
/* Init data for the MPU */
static struct i2c_board_info __initdata single_chip_board_info[] = {
{
I2C_BOARD_INFO("mpu9150", 0x68),
//.irq = (IH_GPIO_BASE + MPUIRQ_GPIO), Not really sure if these can be configured on this platform
.platform_data = &gyro_platform_data,
},
};

/* I2C0 PINMUX pins */
static short omapl138_i2c0_pins[] __initdata = {
DA850_I2C0_SDA, DA850_I2C0_SCL, -1
};

static struct davinci_i2c_platform_data i2c_pdata = {
.bus_freq = 400 /* kHz */,
.bus_delay = 0 /* usec */,
//.sda_pin; /* GPIO pin ID to use for SDA */
//.scl_pin; /* GPIO pin ID to use for SCL */
};
static __init void omapl138_config_i2c0(void)
{
int ret;
// Do the PINMUX
ret = davinci_cfg_reg_list(omapl138_i2c0_pins);
if (ret) {
pr_warning("%s: LCDK gpio mux setup failed: %d\n",
__func__, ret);
return;
}
// Init I2C
davinci_init_i2c(&i2c_pdata);
// Register the board 
i2c_register_board_info(1, single_chip_board_info, ARRAY_SIZE(single_chip_board_info));
}

I'm loading the driver as a module but the IC20 clock doesn't change from a high value on the oscilloscope so something should be wrong. The booting messages:

NAND: 512 MiB
MMC: davinci: 0
Bad block table found at page 262080, version 0x01
Bad block table found at page 262016, version 0x01
In: serial
Out: serial
Err: serial
ARM Clock : 456000000 Hz
DDR Clock : 150000000 Hz
Net: Ethernet PHY: GENERIC @ 0x07
DaVinci-EMAC
Hit any key to stop autoboot: 0
BOOTP broadcast 1
DHCP client bound to address 192.168.1.133
Using DaVinci-EMAC device
TFTP from server 192.168.1.137; our IP address is 192.168.1.133
Filename 'uImage'.
Load address: 0xc0700000
Loading: ###########T #################################T #####################
#####T ################T #############################################
#################################################################
#################################################################
#################################################################
#################################################T ################
######
done
Bytes transferred = 2027192 (1eeeb8 hex)
Using DaVinci-EMAC device
TFTP from server 192.168.1.137; our IP address is 192.168.1.133
Filename 'uImage'.
Load address: 0xc0700000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
######
done
Bytes transferred = 2027192 (1eeeb8 hex)
## Booting kernel from Legacy Image at c0700000 ...
Image Name: Linux-3.3.0-g9287243-dirty
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2027128 Bytes = 1.9 MiB
Load Address: c0008000
Entry Point: c0008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.3.0-g9287243-dirty (root@victor-desktop) (gcc version 4.5.3 20110311 (prerelease) (GCC) ) #1 PREEMPT Sat Mar 9 12:33:23 CET 2013
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: AM18x/OMAP-L138 Hawkboard
Memory policy: ECC disabled, Data cache writeback
BUG: mapping for 0x80000000 at 0xfffe0000 out of vmalloc space
DaVinci da850/omap-l138/am18x variant 0x1
On node 0 totalpages: 32768
free_area_init_node: node 0, pgdat c03cf18c, node_mem_map c03ea000
DMA zone: 256 pages used for memmap
DMA zone: 0 pages reserved
DMA zone: 32512 pages, LIFO batch:7
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
Kernel command line: ip=192.168.1.6 noinitrd console=ttyS2,115200n8 root=/dev/nfs rw nfsroot=192.168.1.137:/home/victor/PFC_material/LCDK/ti-sdk-omapl138-lcdk-01.00.00/erle-stuff/filesystem/fs_cre4
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 125896k/125896k available, 5176k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc8800000 - 0xff000000 ( 872 MB)
lowmem : 0xc0000000 - 0xc8000000 ( 128 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc038cd80 (3604 kB)
.init : 0xc038d000 - 0xc03ae000 ( 132 kB)
.data : 0xc03ae000 - 0xc03cfb00 ( 135 kB)
.bss : 0xc03cfb24 - 0xc03e96ec ( 103 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:245
Console: colour dummy device 80x30
Calibrating delay loop... 227.32 BogoMIPS (lpj=1136640)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0xc02a4520 - 0xc02a455c
gpiochip_add: registered GPIOs 0 to 31 on device: DaVinci
gpiochip_add: registered GPIOs 32 to 63 on device: DaVinci
gpiochip_add: registered GPIOs 64 to 95 on device: DaVinci
gpiochip_add: registered GPIOs 96 to 127 on device: DaVinci
gpiochip_add: registered GPIOs 128 to 143 on device: DaVinci
DaVinci: 144 gpio irqs
NET: Registered protocol family 16
i2c-core: driver [dummy] registered
EMAC: MII PHY configured
MUX: initialized GPIO3_12
MUX: Setting register GPIO3_12
PINMUX7 (0x0000001c) = 0x10110110 -> 0x10118110
MUX: initialized GPIO3_13
MUX: Setting register GPIO3_13
PINMUX7 (0x0000001c) = 0x10118110 -> 0x10118810
MUX: initialized GPIO2_4
MUX: Setting register GPIO2_4
PINMUX6 (0x00000018) = 0x00000000 -> 0x00008000
MUX: initialized GPIO6_13
MUX: Setting register GPIO6_13
PINMUX13 (0x00000034) = 0x00000000 -> 0x00000800
MUX: initialized GPIO8_10
MUX: Setting register GPIO8_10
PINMUX18 (0x00000048) = 0x00000000 -> 0x80000000
MUX: initialized GPIO8_12
MUX: Setting register GPIO8_12
PINMUX18 (0x00000048) = 0x80000000 -> 0x80800000
------------[ cut here ]------------
WARNING: at fs/sysfs/dir.c:481 sysfs_add_one+0x94/0xc4()
sysfs: cannot create duplicate filename '/devices/platform/watchdog'
Modules linked in:
[<c000d5bc>] (unwind_backtrace+0x0/0xf0) from [<c0017518>] (warn_slowpath_common+0x4c/0x64)
[<c0017518>] (warn_slowpath_common+0x4c/0x64) from [<c00175c4>] (warn_slowpath_fmt+0x30/0x40)
[<c00175c4>] (warn_slowpath_fmt+0x30/0x40) from [<c00d6f70>] (sysfs_add_one+0x94/0xc4)
[<c00d6f70>] (sysfs_add_one+0x94/0xc4) from [<c00d7000>] (create_dir+0x60/0xc0)
[<c00d7000>] (create_dir+0x60/0xc0) from [<c00d7110>] (sysfs_create_dir+0x84/0xc0)
[<c00d7110>] (sysfs_create_dir+0x84/0xc0) from [<c014db98>] (kobject_add_internal+0xb4/0x1d8)
[<c014db98>] (kobject_add_internal+0xb4/0x1d8) from [<c014dff0>] (kobject_add+0x50/0x98)
[<c014dff0>] (kobject_add+0x50/0x98) from [<c0184b3c>] (device_add+0xc4/0x564)
[<c0184b3c>] (device_add+0xc4/0x564) from [<c01883c0>] (platform_device_add+0xfc/0x1b0)
[<c01883c0>] (platform_device_add+0xfc/0x1b0) from [<c0394154>] (davinci_init_devices+0x18/0x24)
[<c0394154>] (davinci_init_devices+0x18/0x24) from [<c000889c>] (do_one_initcall+0x30/0x16c)
[<c000889c>] (do_one_initcall+0x30/0x16c) from [<c038d810>] (kernel_init+0x78/0x11c)
[<c038d810>] (kernel_init+0x78/0x11c) from [<c0009d90>] (kernel_thread_exit+0x0/0x8)
---[ end trace 1b75b31a2719ed1c ]---
kobject_add_internal failed for watchdog with -EEXIST, don't try to register things with the same name in the same directory.
[<c000d5bc>] (unwind_backtrace+0x0/0xf0) from [<c014dca4>] (kobject_add_internal+0x1c0/0x1d8)
[<c014dca4>] (kobject_add_internal+0x1c0/0x1d8) from [<c014dff0>] (kobject_add+0x50/0x98)
[<c014dff0>] (kobject_add+0x50/0x98) from [<c0184b3c>] (device_add+0xc4/0x564)
[<c0184b3c>] (device_add+0xc4/0x564) from [<c01883c0>] (platform_device_add+0xfc/0x1b0)
[<c01883c0>] (platform_device_add+0xfc/0x1b0) from [<c0394154>] (davinci_init_devices+0x18/0x24)
[<c0394154>] (davinci_init_devices+0x18/0x24) from [<c000889c>] (do_one_initcall+0x30/0x16c)
[<c000889c>] (do_one_initcall+0x30/0x16c) from [<c038d810>] (kernel_init+0x78/0x11c)
[<c038d810>] (kernel_init+0x78/0x11c) from [<c0009d90>] (kernel_thread_exit+0x0/0x8)
bio: create slab <bio-0> at 0
i2c-core: driver [pca953x] registered
i2c-core: driver [pcf857x] registered
SCSI subsystem initialized
libata version 3.00 loaded.
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c_davinci i2c_davinci.1: input_clock = 24000000, CLK = 10
i2c_davinci i2c_davinci.1: PSC = 2
i2c_davinci i2c_davinci.1: CLKL = 1
i2c_davinci i2c_davinci.1: CLKH = 5
i2c_davinci i2c_davinci.1: bus_freq = 400kHz, bus_delay = 0
i2c i2c-1: adapter [DaVinci I2C adapter] registered
i2c 1-0068: uevent
i2c i2c-1: client [mpu9150] registered with bus id 1-0068
Switching to clocksource timer0_1
musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
msgmni has been set to 245
io scheduler noop registered (default)
Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a AR7
serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a AR7
serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a AR7
console [ttyS2] enabled
brd: module loaded
davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
davinci_mdio davinci_mdio.0: detected phy mask ffffff7f
davinci_mdio.0: probed
davinci_mdio davinci_mdio.0: phy[7]: device davinci_mdio-0:07, driver unknown
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci ohci.0: DA8xx OHCI
ohci ohci.0: new USB bus registered, assigned bus number 1
Waiting for USB PHY clock good...
ohci ohci.0: irq 59, io mem 0x01e25000
usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: DA8xx OHCI
usb usb1: Manufacturer: Linux 3.3.0-g9287243-dirty ohci_hcd
usb usb1: SerialNumber: ohci.0
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
i2c /dev entries driver
i2c-dev: adapter [DaVinci I2C adapter] registered as minor 1
davinci_mmc davinci_mmc.0: Using DMA, 4-bit mode
TCP cubic registered
NET: Registered protocol family 17
console [netcon0] enabled
netconsole: network logging started
davinci_emac davinci_emac.1: using random MAC addr: fa:c1:b0:61:b0:09
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
davinci_mdio davinci_mdio.0: resetting idled controller
net eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=davinci_mdio-0:07, id=7c0f1)
PHY: davinci_mdio-0:07 - Link is Up - 100/Full
IP-Config: Guessing netmask 255.255.255.0
IP-Config: Complete:
device=eth0, addr=192.168.1.6, mask=255.255.255.0, gw=255.255.255.255,
host=192.168.1.6, domain=, nis-domain=(none),
bootserver=255.255.255.255, rootserver=192.168.1.137, rootpath=
VFS: Mounted root (nfs filesystem) on device 0:14.
Freeing init memory: 132K
System initialization...

If I try to load the driver on Linux i get the following:

modprobe inv-mpu-iio
inv_mpu_iio: module is from the staging directory, the quality is unknown, you have been warned.
inv-mpu-iio 1-0068: probe
i2c i2c-1: master_xfer[0] W, addr=0x68, len=2
i2c_davinci i2c_davinci.1: i2c_davinci_xfer: msgs: 1
i2c_davinci i2c_davinci.1: controller timed out
i2c_davinci i2c_davinci.1: initiating i2c bus recovery
i2c_davinci i2c_davinci.1: input_clock = 24000000, CLK = 10
i2c_davinci i2c_davinci.1: PSC = 2
i2c_davinci i2c_davinci.1: CLKL = 1
i2c_davinci i2c_davinci.1: CLKH = 5
i2c_davinci i2c_davinci.1: bus_freq = 400kHz, bus_delay = 0
i2c_davinci i2c_davinci.1: i2c_davinci_xfer [1/1] ret: -110
i2c i2c-1: inv_mpu_probe failed -110
inv-mpu-iio: probe of 1-0068 failed with error -5
i2c-core: driver [inv-mpu-iio] registered

I'm going to try digging on the invensense drivers however the thing that is worrying me is that the I2C0 SCL signal is on high value all the time. Shouldn't it be changing as expected of a clock?

Any feedback is greatly appreciated.

  • I debugged the driver for the sensor and i ended up in the function i2c_transfer at the file drivers/i2c/i2c-core.c. It seems there's some problem transmitting the signals when setting up the driver. This reinforces more my guess: i've got some problem with my I2C0 configuration.

    Moreover, if i disconnect the sensor from the SCL and SCA pins i obtain the same when I try to load the driver:

    modprobe inv-mpu-iio
    inv_mpu_iio: module is from the staging directory, the quality is unknown, you have been warned.
    inv-mpu-iio 1-0068: probe
    i2c i2c-1: master_xfer[0] W, addr=0x68, len=2
    i2c_davinci i2c_davinci.1: i2c_davinci_xfer: msgs: 1
    i2c_davinci i2c_davinci.1: controller timed out
    i2c_davinci i2c_davinci.1: initiating i2c bus recovery
    i2c_davinci i2c_davinci.1: input_clock = 24000000, CLK = 10
    i2c_davinci i2c_davinci.1: PSC = 2
    i2c_davinci i2c_davinci.1: CLKL = 1
    i2c_davinci i2c_davinci.1: CLKH = 5
    i2c_davinci i2c_davinci.1: bus_freq = 400kHz, bus_delay = 0
    i2c_davinci i2c_davinci.1: i2c_davinci_xfer [1/1] ret: -110
    i2c i2c-1: inv_mpu_probe failed -110
    inv-mpu-iio: probe of 1-0068 failed with error -5
    i2c-core: driver [inv-mpu-iio] registered
  • The docs mention that the serial data (SDA) and the serial clock (SCL) signals are connected to VDD through pull-up resistors. How can I test that the I2C0 bus is working properly without connecting it? I already did try to set the registers manually using devmem command from Linux but the scope is still showing a high value.

    Another thing that i observed that seems weird is that after setting up the speed of the bus with the following code in the board file:

    static struct davinci_i2c_platform_data i2c_pdata = {
    .bus_freq = 400 /* kHz */,
    .bus_delay = 0 /* usec */,
    //.sda_pin; /* GPIO pin ID to use for SDA */
    //.scl_pin; /* GPIO pin ID to use for SCL */
    };
    When I check the registers from user space with devmem, the values are not the ones expected but the ones by default. Does this make any sense?
  • Not sure which code base you are using. Just a guess. I think this call

      davinci_init_i2c(&i2c_pdata);

    should be

      da8xx_register_i2c(0, &i2c_pdata);

    I believe the function davinci_init_i2c() uses the wrong base address for I2C0 on the OMAP-L138.

  • Norman,

    Thanks for your answer. It was helpful. I'm using the last kernel release from the arago git repository of the linux-davinci kernel (found http://arago-project.org/git/projects/?p=linux-davinci.git;a=summary).

    After changing the code to according to your advice:

    static __init void omapl138_config_i2c0(void)
    {
    int ret;
    // Do the PINMUX
    ret = davinci_cfg_reg_list(omapl138_i2c0_pins);
    if (ret) {
    pr_warning("%s: LCDK gpio mux setup failed: %d\n",
    __func__, ret);
    return;
    }
    // Init I2C
    //davinci_init_i2c(&i2c_pdata);
    ret = da8xx_register_i2c(0, &i2c_pdata);
    if (ret)
    pr_warning("da830_evm_init: i2c0 registration failed: %d\n", ret);
    // Config the I2C0
    // Register the board 
    i2c_register_board_info(1, single_chip_board_info,
    ARRAY_SIZE(single_chip_board_info));

    }

     I could see the I20C CLK signal emiting a pulse:

    So definitely that was really advancing. However, i tried to connect my sensor to the I2C0 port and it's still not registering fine:

    inv-mpu-iio 1-0068: probe
    debugging: File inv_mpu_core.c: inv_mpu_probe
    debugging: File inv_mpu_core.c: inv_check_chip_type
    debugging: File inv_mpu_core.c: inv_check_chip_type, type INV_MPU9150
    debugging: File inv_mpu_core.c: set_power_itg, power_on
    debugging: File inv_mpu_core.c: set_power_itg, st->chip_config.gyro_enable
    debugging: File inv_mpu_core.c: inv_i2c_single_write
    debugging: inv_i2c_single_write (i2c_addr, reg, data): WS686B01
    i2c i2c-1: master_xfer[0] W, addr=0x68, len=2
    i2c_davinci i2c_davinci.1: i2c_davinci_xfer: msgs: 1
    i2c_davinci i2c_davinci.1: i2c_davinci_isr: stat=0x5
    i2c_davinci i2c_davinci.1: i2c_davinci_isr: stat=0x6
    i2c_davinci i2c_davinci.1: i2c_davinci_xfer [1/1] ret: 2
    debugging: File inv_mpu_core.c: set_power_itg, power_on 2
    debugging: File inv_mpu_core.c: inv_i2c_single_write
    debugging: inv_i2c_single_write (i2c_addr, reg, data): WS686C38
    i2c i2c-1: master_xfer[0] W, addr=0x68, len=2
    i2c_davinci i2c_davinci.1: i2c_davinci_xfer: msgs: 1
    i2c_davinci i2c_davinci.1: i2c_davinci_isr: stat=0x5
    i2c_davinci i2c_davinci.1: i2c_davinci_isr: stat=0x6
    i2c_davinci i2c_davinci.1: i2c_davinci_xfer [1/1] ret: 2
    debugging: File inv_mpu_core.c: inv_mpu_probe, out_free
    debugging: File inv_mpu_core.c: inv_mpu_probe, out_no_free
    i2c i2c-1: inv_mpu_probe failed 0
    inv-mpu-iio: probe of 1-0068 failed with error -5
    i2c-core: driver [inv-mpu-iio] registered

     I introduced the debugging green lines for clarity however it doesn't make much sense to me. I'll keep debugging the code. Thanks for the help!

  • Hmm...Even if there was no device, I would have expected a least 7 clock pulses at 400kHz.. Can you post both SCL and SDA scope traces for that two byte write?

    You might want to try without the platform device and use i2c utils user space code to test out using direct i2c messages.

    You should unverify my post. Unverified threads get more attention from those my knowledgable than me.

  • Thanks for your advice Norman.

    I'm actually working at 100 KHz (right now my scope is a bit limited, hopefully in the following weeks i'll update that) and i'm setting up the I2C0 with the following code:

    /* Take a look at the README file of the Invensense driver */
    static struct mpu_platform_data gyro_platform_data = {
    .int_config = 0x00,
    .level_shifter = 0,
    .orientation = { -1, 0, 0,
    0, 1, 0,
    0, 0, -1 },
    .sec_slave_type = SECONDARY_SLAVE_TYPE_COMPASS,
    .sec_slave_id = COMPASS_ID_AK8975,
    .secondary_i2c_addr = 0x0E
    };
    /* Init data for the MPU */
    static struct i2c_board_info __initdata single_chip_board_info[] = {
    {
    I2C_BOARD_INFO("mpu9150", 0x68),
    //.irq = (IH_GPIO_BASE + MPUIRQ_GPIO), Not really sure if these can be configured on this platform
    .platform_data = &gyro_platform_data,
    },
    };

    /* I2C0 PINMUX pins */
    static short omapl138_i2c0_pins[] __initdata = {
    DA850_I2C0_SDA, DA850_I2C0_SCL, -1
    };

    static struct davinci_i2c_platform_data i2c_pdata = {
    .bus_freq = 100 /* kHz */,
    .bus_delay = 0 /* usec */,
    //.sda_pin; /* GPIO pin ID to use for SDA */
    //.scl_pin; /* GPIO pin ID to use for SCL */
    };
    static __init void omapl138_config_i2c0(void)
    {
    int ret;
    // Do the PINMUX
    ret = davinci_cfg_reg_list(omapl138_i2c0_pins);
    if (ret) {
    pr_warning("%s: LCDK gpio mux setup failed: %d\n",
    __func__, ret);
    return;
    }
    // Init I2C
    //davinci_init_i2c(&i2c_pdata);
    ret = da8xx_register_i2c(0, &i2c_pdata);
    if (ret)
    pr_warning("da830_evm_init: i2c0 registration failed: %d\n", ret);
    // Config the I2C0
    // Register the board 
    i2c_register_board_info(1, single_chip_board_info,
    ARRAY_SIZE(single_chip_board_info));

    }

    The SCL and SDA images (with no sensor connected), If i'm not mistaken i'm actually getting 9 clock pulses:

    and the output:

    modprobe inv-mpu-iio
    inv_mpu_iio: module is from the staging directory, the quality is unknown, you have been warned.
    inv-mpu-iio 1-0068: probe
    i2c i2c-1: master_xfer[0] W, addr=0x68, len=2
    i2c_davinci i2c_davinci.1: i2c_davinci_xfer: msgs: 1
    i2c_davinci i2c_davinci.1: initiating i2c bus recovery
    i2c_davinci i2c_davinci.1: input_clock = 24000000, CLK = 70
    i2c_davinci i2c_davinci.1: PSC = 2
    i2c_davinci i2c_davinci.1: CLKL = 35
    i2c_davinci i2c_davinci.1: CLKH = 35
    i2c_davinci i2c_davinci.1: bus_freq = 100kHz, bus_delay = 0
    i2c_davinci i2c_davinci.1: i2c_davinci_isr: stat=0x2
    i2c_davinci i2c_davinci.1: i2c_davinci_isr: stat=0x3
    i2c_davinci i2c_davinci.1: i2c_davinci_isr: stat=0x6
    i2c_davinci i2c_davinci.1: i2c_davinci_xfer [1/1] ret: -121
    i2c i2c-1: inv_mpu_probe failed -121
    inv-mpu-iio: probe of 1-0068 failed with error -5
    i2c-core: driver [inv-mpu-iio] registered

    ----------------------------------------------------------------------------------------------------------- 

    ----------------------------------------------------------------------------------------------------------- 

    Now, if i connect the sensor i get the following captures in the scope:

    This last SDA signal was not clear at all so I re-compiled the kernel to use the I2C0 at 50KHz and did the same test again obtaining a more clear version of this SDA signal with the sensor connected:

      

    The output (debugging lines added for clarity) from the serial connection:

    modprobe inv-mpu-iio
    inv_mpu_iio: module is from the staging directory, the quality is unknown, you .
    inv-mpu-iio 1-0068: probe
    debugging: File inv_mpu_core.c: inv_mpu_probe
    debugging: File inv_mpu_core.c: inv_check_chip_type
    debugging: File inv_mpu_core.c: inv_check_chip_type, type INV_MPU9150
    debugging: File inv_mpu_core.c: set_power_itg, power_on
    debugging: File inv_mpu_core.c: set_power_itg, st->chip_config.gyro_enable
    debugging: File inv_mpu_core.c: inv_i2c_single_write
    debugging: inv_i2c_single_write (i2c_addr, reg, data): WS686B01
    i2c i2c-1: master_xfer[0] W, addr=0x68, len=2
    i2c_davinci i2c_davinci.1: i2c_davinci_xfer: msgs: 1
    i2c_davinci i2c_davinci.1: i2c_davinci_isr: stat=0x5
    i2c_davinci i2c_davinci.1: i2c_davinci_isr: stat=0x6
    i2c_davinci i2c_davinci.1: i2c_davinci_xfer [1/1] ret: 2
    debugging: File inv_mpu_core.c: set_power_itg, power_on 2
    debugging: File inv_mpu_core.c: inv_i2c_single_write
    debugging: inv_i2c_single_write (i2c_addr, reg, data): WS686C38
    i2c i2c-1: master_xfer[0] W, addr=0x68, len=2
    i2c_davinci i2c_davinci.1: i2c_davinci_xfer: msgs: 1
    i2c_davinci i2c_davinci.1: i2c_davinci_isr: stat=0x5
    i2c_davinci i2c_davinci.1: i2c_davinci_isr: stat=0x6
    i2c_davinci i2c_davinci.1: i2c_davinci_xfer [1/1] ret: 2
    debugging: File inv_mpu_core.c: inv_mpu_probe, out_free
    debugging: File inv_mpu_core.c: inv_mpu_probe, out_no_free
    i2c i2c-1: inv_mpu_probe failed 0
    inv-mpu-iio: probe of 1-0068 failed with error -5
    i2c-core: driver [inv-mpu-iio] registered

    My scope is really limited right now but it seems to me that it's a software problem as I previously mentioned. I'll keep digging into it.

  • All right finally found the problem. It was inside of the code. The initial question was solved changing the call from davinci_init_i2c(&i2c_pdata); to da8xx_register_i2c(0, &i2c_pdata);

    Thanks again for your support Norman. Really!