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.

EVM Dm355 I2C timeout

Hello every one ,
I m using Mv4 on EVMDM355.
I want to use J30 & J31 as general purpose GPIO pins.
For that I need to change the MUX select line via MS0430 using I2C.
To do so, I ve  used i2c-dev interface here is the code..
This is just to test I2C , so I tried to toggle LEDs on MSP430

//********************************************************************************
//         test_i2c.c
//********************************************************************************
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <getopt.h>
#include <errno.h>
#include "i2c-dev.h"

#define __E(fmt, args...) fprintf(stderr, "i2ctest Error: " fmt, ## args)

#define I2C_DEVICE "/dev/i2c/0"
#define I2C_DEV_ADDR 0x25 // address of MSP430


int init_i2c(void)
{
    int fd;
    fd = open(I2C_DEVICE, O_RDWR);
    if (fd < 0) {
        __E("Error while opening i2c device %s\n", I2C_DEVICE);
        return fd;
    }
    if (ioctl(fd, I2C_SLAVE, I2C_DEV_ADDR) == -1) {
        __E("Failed to set I2C_SLAVE %#x\n", I2C_DEV_ADDR);
        return -1;
    }
    return fd;
}

int main(int argc, char **argv)
{
    int     i2cfd;
    __u8    buf[256];
    
    i2cfd = init_i2c();

      buf[0] = 0x03;
      buf[1] = 0xFF;
      write(i2cfd, buf, 1);
      read(i2cfd, buf, 2);
   printf("data on Address %x is  %x   \n",buf[0], buf[1]);

      buf[0] = 0x03;
      buf[1] = 0x00;
      write(i2cfd, buf, 1);
      read(i2cfd, buf, 2);
   printf("data on Address %x is  %x   \n",buf[0], buf[1]);

    close(i2cfd);
    exit(EXIT_SUCCESS);
}
//************************************************************************
//        here is the log when I run this application...
//************************************************************************

root@192.168.2.229:/home# ./test_i2c        
data on Address 3 is  ff   
data on Address 3 is  0  

//************************************************************************
//        Kernel MSges
//************************************************************************

DaVinci I2C WARNING: timeout waiting for bus ready

DaVinci I2C WARNING: timeout waiting for bus ready

DaVinci I2C WARNING: timeout waiting for bus ready

SUCCESS gpio_direction_input(CORE)

SUCCESS gpio_direction_output(CORE)

SUCCESS __gpio_set(CORE)

MUX: initialized GPIO14

MUX: initialized GPIO15

SUCCESS __gpio_set(CORE)

SUCCESS __gpio_set(CORE)

.
.
.
SUCCESS __gpio_set(CORE)

SUCCESS __gpio_set(CORE)

SUCCESS __gpio_set(CORE)

MUX: initialized I2C_SDA

MUX: initialized I2C_SCL
//*****************************************************************

Though the reading and witting in file done successfully (I think so ;) ),but  the LEDs are "ON" throughout..:(

I have used printk in gpio.c file.

I am also getting the same "DaVinci I2C WARNING: timeout waiting for bus ready"while boot up.While booting it also shows i2c error -111.
Please help.


If you know any other simple way to change mux position than tell me ASAP.Thx in advance.